diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-26 06:49:48 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-11-26 06:49:48 +0000 |
commit | 6f3ad9bd3d1c0fd53539d55743b445d67360e911 (patch) | |
tree | 00e0844b8abbfc03ad25372852a12379e0c28e9d | |
parent | e4b54208d0e98677db83b92a458be6847258e54c (diff) | |
download | ruby-6f3ad9bd3d1c0fd53539d55743b445d67360e911.tar.gz |
* bignum.c (big_div_struct): added volatile to 'stop' member.
Otherwise, "if (bds->stop)" check in bigdivrem1 don't read
memory and ignore interrupt.
* bignum.c (bigdivrem, rb_big_stop): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37849 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | bignum.c | 8 |
2 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,10 @@ +Mon Nov 26 15:33:02 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com> + + * bignum.c (big_div_struct): added volatile to 'stop' member. + Otherwise, "if (bds->stop)" check in bigdivrem1 don't read + memory and ignore interrupt. + * bignum.c (bigdivrem, rb_big_stop): ditto. + Mon Nov 26 12:11:09 2012 Nobuyoshi Nakada <nobu@ruby-lang.org> * win32/Makefile.sub (DLNOBJ): missing in r37821. @@ -2657,7 +2657,7 @@ rb_big_mul(VALUE x, VALUE y) struct big_div_struct { long nx, ny; BDIGIT *yds, *zds; - VALUE stop; + volatile VALUE stop; }; static void * @@ -2708,8 +2708,8 @@ bigdivrem1(void *ptr) static void rb_big_stop(void *ptr) { - VALUE *stop = (VALUE*)ptr; - *stop = Qtrue; + struct big_div_struct *bds = ptr; + bds->stop = Qtrue; } static VALUE @@ -2794,7 +2794,7 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volatile VALUE *modp) bds.yds = yds; bds.stop = Qfalse; if (nx > 10000 || ny > 10000) { - rb_thread_call_without_gvl(bigdivrem1, &bds, rb_big_stop, &bds.stop); + rb_thread_call_without_gvl(bigdivrem1, &bds, rb_big_stop, &bds); } else { bigdivrem1(&bds); |