… | |
… | |
1277 | cctx_destroy (coro_cctx *cctx) |
1277 | cctx_destroy (coro_cctx *cctx) |
1278 | { |
1278 | { |
1279 | if (!cctx) |
1279 | if (!cctx) |
1280 | return; |
1280 | return; |
1281 | |
1281 | |
1282 | assert (cctx != cctx_current);//D temporary |
1282 | assert (("FATAL: tried to destroy current cctx", cctx != cctx_current));//D temporary? |
1283 | |
1283 | |
1284 | --cctx_count; |
1284 | --cctx_count; |
1285 | coro_destroy (&cctx->cctx); |
1285 | coro_destroy (&cctx->cctx); |
1286 | |
1286 | |
1287 | /* coro_transfer creates new, empty cctx's */ |
1287 | /* coro_transfer creates new, empty cctx's */ |
… | |
… | |
1405 | coro_setup (aTHX_ next); |
1405 | coro_setup (aTHX_ next); |
1406 | } |
1406 | } |
1407 | else |
1407 | else |
1408 | load_perl (aTHX_ next); |
1408 | load_perl (aTHX_ next); |
1409 | |
1409 | |
1410 | assert (!prev->cctx);//D temporary |
|
|
1411 | |
|
|
1412 | /* possibly untie and reuse the cctx */ |
1410 | /* possibly untie and reuse the cctx */ |
1413 | if (expect_true ( |
1411 | if (expect_true ( |
1414 | cctx_current->idle_sp == STACKLEVEL |
1412 | cctx_current->idle_sp == STACKLEVEL |
1415 | && !(cctx_current->flags & CC_TRACE) |
1413 | && !(cctx_current->flags & CC_TRACE) |
1416 | && !force_cctx |
1414 | && !force_cctx |
… | |
… | |
1473 | else |
1471 | else |
1474 | coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */ |
1472 | coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */ |
1475 | |
1473 | |
1476 | if (coro->mainstack |
1474 | if (coro->mainstack |
1477 | && coro->mainstack != main_mainstack |
1475 | && coro->mainstack != main_mainstack |
|
|
1476 | && coro->slot |
1478 | && !PL_dirty) |
1477 | && !PL_dirty) |
1479 | { |
1478 | { |
1480 | struct coro temp; |
1479 | struct coro temp; |
1481 | |
1480 | |
1482 | assert (("FATAL: tried to destroy currently running coroutine (please report)", !(coro->flags & CF_RUNNING))); |
1481 | assert (("FATAL: tried to destroy currently running coroutine", coro->mainstack != PL_mainstack)); |
1483 | |
1482 | |
1484 | save_perl (aTHX_ &temp); |
1483 | save_perl (aTHX_ &temp); |
1485 | load_perl (aTHX_ coro); |
1484 | load_perl (aTHX_ coro); |
1486 | |
1485 | |
1487 | coro_destruct_perl (aTHX_ coro); |
1486 | coro_destruct_perl (aTHX_ coro); |