Skip to content

Instantly share code, notes, and snippets.

@kosaki
Created November 26, 2012 05:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kosaki/4146711 to your computer and use it in GitHub Desktop.
Save kosaki/4146711 to your computer and use it in GitHub Desktop.
diff --git a/bignum.c b/bignum.c
index 97be53f..47d9689 100644
--- a/bignum.c
+++ b/bignum.c
@@ -2788,6 +2788,7 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volati
while (j--) zds[j] = xds[j];
}
+ retry:
bds.nx = nx;
bds.ny = ny;
bds.zds = zds;
@@ -2795,6 +2796,11 @@ bigdivrem(VALUE x, VALUE y, volatile VALUE *divp, volat
bds.stop = Qfalse;
if (nx > 10000 || ny > 10000) {
rb_thread_call_without_gvl(bigdivrem1, &bds, rb_big_stop, &bds.stop);
+
+ if (bds.stop == Qtrue) {
+ /* execute trap handler, but exception was not raised. */
+ goto retry;
+ }
}
else {
bigdivrem1(&bds);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment