… | |
… | |
137 | |
137 | |
138 | #define IN_DESTRUCT PL_dirty |
138 | #define IN_DESTRUCT PL_dirty |
139 | |
139 | |
140 | #if __GNUC__ >= 3 |
140 | #if __GNUC__ >= 3 |
141 | # define attribute(x) __attribute__(x) |
141 | # define attribute(x) __attribute__(x) |
142 | # define expect(expr,value) __builtin_expect ((expr),(value)) |
142 | # define expect(expr,value) __builtin_expect ((expr), (value)) |
143 | # define INLINE static inline |
143 | # define INLINE static inline |
144 | #else |
144 | #else |
145 | # define attribute(x) |
145 | # define attribute(x) |
146 | # define expect(expr,value) (expr) |
146 | # define expect(expr,value) (expr) |
147 | # define INLINE static |
147 | # define INLINE static |
… | |
… | |
615 | { |
615 | { |
616 | while (expect_true (cxix >= 0)) |
616 | while (expect_true (cxix >= 0)) |
617 | { |
617 | { |
618 | PERL_CONTEXT *cx = &ccstk[cxix--]; |
618 | PERL_CONTEXT *cx = &ccstk[cxix--]; |
619 | |
619 | |
620 | if (expect_true (CxTYPE (cx) == CXt_SUB || CxTYPE (cx) == CXt_FORMAT)) |
620 | if (expect_true (CxTYPE (cx) == CXt_SUB) || expect_false (CxTYPE (cx) == CXt_FORMAT)) |
621 | { |
621 | { |
622 | CV *cv = cx->blk_sub.cv; |
622 | CV *cv = cx->blk_sub.cv; |
623 | |
623 | |
624 | if (expect_true (CvDEPTH (cv))) |
624 | if (expect_true (CvDEPTH (cv))) |
625 | { |
625 | { |
… | |
… | |
999 | |
999 | |
1000 | assert (("FATAL: tried to destroy currently running coroutine", coro->mainstack != PL_mainstack)); |
1000 | assert (("FATAL: tried to destroy currently running coroutine", coro->mainstack != PL_mainstack)); |
1001 | |
1001 | |
1002 | save_perl (aTHX_ current); |
1002 | save_perl (aTHX_ current); |
1003 | load_perl (aTHX_ coro); |
1003 | load_perl (aTHX_ coro); |
|
|
1004 | |
1004 | coro_unwind_stacks (aTHX); |
1005 | coro_unwind_stacks (aTHX); |
1005 | coro_destruct_stacks (aTHX); |
1006 | coro_destruct_stacks (aTHX); |
1006 | |
1007 | |
1007 | // now save some sv's to be free'd later |
1008 | // now save some sv's to be free'd later |
1008 | svf [0] = GvSV (PL_defgv); |
1009 | svf [0] = GvSV (PL_defgv); |
… | |
… | |
2476 | /* Coro::Semaphore & Coro::Signal */ |
2477 | /* Coro::Semaphore & Coro::Signal */ |
2477 | |
2478 | |
2478 | static SV * |
2479 | static SV * |
2479 | coro_waitarray_new (pTHX_ int count) |
2480 | coro_waitarray_new (pTHX_ int count) |
2480 | { |
2481 | { |
2481 | /* a semaphore contains a counter IV in $sem->[0] and any waiters after that */ |
2482 | /* a waitarray=semaphore contains a counter IV in $sem->[0] and any waiters after that */ |
2482 | AV *av = newAV (); |
2483 | AV *av = newAV (); |
2483 | SV **ary; |
2484 | SV **ary; |
2484 | |
2485 | |
2485 | /* unfortunately, building manually saves memory */ |
2486 | /* unfortunately, building manually saves memory */ |
2486 | Newx (ary, 2, SV *); |
2487 | Newx (ary, 2, SV *); |