--- Coro/Coro/State.xs 2008/11/18 10:35:01 1.295 +++ Coro/Coro/State.xs 2008/11/18 10:39:52 1.296 @@ -1841,6 +1841,16 @@ slf_frame.prepare = 0; /* invalidate the frame, we are done processing it */ + /* exception handling */ + if (expect_false (coro_throw)) + { + SV *exception = sv_2mortal (coro_throw); + + coro_throw = 0; + sv_setsv (ERRSV, exception); + croak (0); + } + /* return value handling - mostly like entersub */ /* make sure we put something on the stack in scalar context */ if (GIMME_V == G_SCALAR) @@ -1858,16 +1868,6 @@ PUTBACK; } - /* exception handling */ - if (expect_false (coro_throw)) - { - SV *exception = sv_2mortal (coro_throw); - - coro_throw = 0; - sv_setsv (ERRSV, exception); - croak (0); - } - return NORMAL; } @@ -2043,7 +2043,7 @@ SV *count_sv = AvARRAY (av)[0]; /* if we are about to throw, don't actually acquire the lock, just throw */ - if (coro_throw && 0)//D + if (coro_throw) return 0; else if (SvIVX (count_sv) > 0) { @@ -2173,6 +2173,12 @@ { AV *state = (AV *)frame->data; + /* if we are about to throw, return early */ + /* this does not cancel the aio request, but at least */ + /* it quickly returns */ + if (coro_throw) + return 0; + /* one element that is an RV? repeat! */ if (AvFILLp (state) == 0 && SvROK (AvARRAY (state)[0])) return 1;