… | |
… | |
938 | /* copy throw, in case it was set before coro_setup */ |
938 | /* copy throw, in case it was set before coro_setup */ |
939 | CORO_THROW = coro->except; |
939 | CORO_THROW = coro->except; |
940 | } |
940 | } |
941 | |
941 | |
942 | static void |
942 | static void |
943 | coro_destruct (pTHX_ struct coro *coro) |
943 | coro_destruct_perl (pTHX_ struct coro *coro) |
944 | { |
944 | { |
945 | if (!IN_DESTRUCT) |
945 | if (!IN_DESTRUCT) |
946 | { |
946 | { |
947 | /* restore all saved variables and stuff */ |
947 | /* restore all saved variables and stuff */ |
948 | LEAVE_SCOPE (0); |
948 | LEAVE_SCOPE (0); |
… | |
… | |
1471 | --coro_nready; |
1471 | --coro_nready; |
1472 | } |
1472 | } |
1473 | else |
1473 | else |
1474 | coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */ |
1474 | coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */ |
1475 | |
1475 | |
1476 | if (coro->mainstack && coro->mainstack != main_mainstack) |
1476 | if (coro->mainstack |
|
|
1477 | && coro->mainstack != main_mainstack |
|
|
1478 | && !PL_dirty) |
1477 | { |
1479 | { |
1478 | struct coro temp; |
1480 | struct coro temp; |
1479 | |
1481 | |
1480 | assert (("FATAL: tried to destroy currently running coroutine (please report)", !(coro->flags & CF_RUNNING))); |
1482 | assert (("FATAL: tried to destroy currently running coroutine (please report)", !(coro->flags & CF_RUNNING))); |
1481 | |
1483 | |
1482 | save_perl (aTHX_ &temp); |
1484 | save_perl (aTHX_ &temp); |
1483 | load_perl (aTHX_ coro); |
1485 | load_perl (aTHX_ coro); |
1484 | |
1486 | |
1485 | coro_destruct (aTHX_ coro); |
1487 | coro_destruct_perl (aTHX_ coro); |
1486 | |
1488 | |
1487 | load_perl (aTHX_ &temp); |
1489 | load_perl (aTHX_ &temp); |
1488 | |
1490 | |
1489 | coro->slot = 0; |
1491 | coro->slot = 0; |
1490 | } |
1492 | } |