Skip to content

Instantly share code, notes, and snippets.

@kosaki
Created November 26, 2012 05:39
Show Gist options
  • Select an option

  • Save kosaki/4146742 to your computer and use it in GitHub Desktop.

Select an option

Save kosaki/4146742 to your computer and use it in GitHub Desktop.
diff --git a/bignum.c b/bignum.c
index 97be53f..8939282 100644
--- a/bignum.c
+++ b/bignum.c
@@ -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, volati
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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment