--- Coro/Coro/State.xs 2008/12/15 16:41:43 1.343 +++ Coro/Coro/State.xs 2008/12/17 04:57:07 1.345 @@ -1486,7 +1486,7 @@ if (coro->flags & CF_DESTROYED) return 0; - if (coro->on_destroy) + if (coro->on_destroy && !PL_dirty) coro->on_destroy (aTHX_ coro); coro->flags |= CF_DESTROYED; @@ -3338,6 +3338,18 @@ RETVAL void +suspend (Coro::State self) + PROTOTYPE: $ + CODE: + self->flags |= CF_SUSPENDED; + +void +resume (Coro::State self) + PROTOTYPE: $ + CODE: + self->flags &= ~CF_SUSPENDED; + +void _pool_handler (...) CODE: CORO_EXECUTE_SLF_XS (slf_init_pool_handler); @@ -3512,6 +3524,22 @@ } } +MODULE = Coro::State PACKAGE = Coro::SemaphoreSet + +void +_may_delete (SV *sem, int count, int extra_refs) + PPCODE: +{ + AV *av = (AV *)SvRV (sem); + + if (SvREFCNT ((SV *)av) == 1 + extra_refs + && AvFILLp (av) == 0 /* no waiters, just count */ + && SvIV (AvARRAY (av)[0]) == count) + XSRETURN_YES; + + XSRETURN_NO; +} + MODULE = Coro::State PACKAGE = Coro::Signal SV *