… | |
… | |
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); |
1009 | svf [1] = (SV *)GvAV (PL_defgv); |
1010 | svf [1] = (SV *)GvAV (PL_defgv); |
1010 | svf [2] = GvSV (PL_errgv); |
1011 | svf [2] = GvSV (PL_errgv); |
1011 | svf [3] = (SV *)PL_defoutgv; |
1012 | svf [3] = (SV *)PL_defoutgv; |
1012 | svf [4] = PL_rs; |
1013 | svf [4] = PL_rs; |
1013 | svf [5] = GvSV (irsgv); |
1014 | svf [5] = GvSV (irsgv); |
1014 | svf [6] = (SV *)GvHV (PL_hintgv); |
1015 | svf [6] = (SV *)GvHV (PL_hintgv); |
1015 | svf [7] = PL_diehook; |
1016 | svf [7] = PL_diehook; |
1016 | svf [8] = PL_warnhook; |
1017 | svf [8] = PL_warnhook; |
1017 | |
|
|
1018 | assert (9 == sizeof (svf) / sizeof (*svf)); |
1018 | assert (9 == sizeof (svf) / sizeof (*svf)); |
1019 | |
1019 | |
1020 | load_perl (aTHX_ current); |
1020 | load_perl (aTHX_ current); |
1021 | } |
1021 | } |
1022 | |
1022 | |
… | |
… | |
2477 | /* Coro::Semaphore & Coro::Signal */ |
2477 | /* Coro::Semaphore & Coro::Signal */ |
2478 | |
2478 | |
2479 | static SV * |
2479 | static SV * |
2480 | coro_waitarray_new (pTHX_ int count) |
2480 | coro_waitarray_new (pTHX_ int count) |
2481 | { |
2481 | { |
2482 | /* 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 */ |
2483 | AV *av = newAV (); |
2483 | AV *av = newAV (); |
2484 | SV **ary; |
2484 | SV **ary; |
2485 | |
2485 | |
2486 | /* unfortunately, building manually saves memory */ |
2486 | /* unfortunately, building manually saves memory */ |
2487 | Newx (ary, 2, SV *); |
2487 | Newx (ary, 2, SV *); |