… | |
… | |
2599 | |
2599 | |
2600 | /* "undo"/cancel a running slf call - used when cancelling a coro, mainly */ |
2600 | /* "undo"/cancel a running slf call - used when cancelling a coro, mainly */ |
2601 | static void |
2601 | static void |
2602 | slf_destroy (pTHX_ struct coro *coro) |
2602 | slf_destroy (pTHX_ struct coro *coro) |
2603 | { |
2603 | { |
2604 | /* this callback is reserved for slf functions needing to do cleanup */ |
2604 | struct CoroSLF frame = coro->slf_frame; |
2605 | if (coro->slf_frame.destroy && coro->slf_frame.prepare && !PL_dirty) |
|
|
2606 | coro->slf_frame.destroy (aTHX_ &coro->slf_frame); |
|
|
2607 | |
2605 | |
2608 | /* |
2606 | /* |
2609 | * The on_destroy above most likely is from an SLF call. |
2607 | * The on_destroy below most likely is from an SLF call. |
2610 | * Since by definition the SLF call will not finish when we destroy |
2608 | * Since by definition the SLF call will not finish when we destroy |
2611 | * the coro, we will have to force-finish it here, otherwise |
2609 | * the coro, we will have to force-finish it here, otherwise |
2612 | * cleanup functions cannot call SLF functions. |
2610 | * cleanup functions cannot call SLF functions. |
2613 | */ |
2611 | */ |
2614 | coro->slf_frame.prepare = 0; |
2612 | coro->slf_frame.prepare = 0; |
|
|
2613 | coro->slf_frame.destroy = 0; |
|
|
2614 | |
|
|
2615 | /* this callback is reserved for slf functions needing to do cleanup */ |
|
|
2616 | if (frame.destroy && frame.prepare && !PL_dirty) |
|
|
2617 | frame.destroy (aTHX_ &frame); |
2615 | } |
2618 | } |
2616 | |
2619 | |
2617 | /* |
2620 | /* |
2618 | * these not obviously related functions are all rolled into one |
2621 | * these not obviously related functions are all rolled into one |
2619 | * function to increase chances that they all will call transfer with the same |
2622 | * function to increase chances that they all will call transfer with the same |