… | |
… | |
14 | #include "perliol.h" |
14 | #include "perliol.h" |
15 | |
15 | |
16 | #include "schmorp.h" |
16 | #include "schmorp.h" |
17 | |
17 | |
18 | #define ECB_NO_THREADS 1 |
18 | #define ECB_NO_THREADS 1 |
|
|
19 | #define ECB_NO_LIBM 1 |
19 | #include "ecb.h" |
20 | #include "ecb.h" |
20 | |
21 | |
21 | #include <stddef.h> |
22 | #include <stddef.h> |
22 | #include <stdio.h> |
23 | #include <stdio.h> |
23 | #include <errno.h> |
24 | #include <errno.h> |
… | |
… | |
2598 | |
2599 | |
2599 | /* "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 */ |
2600 | static void |
2601 | static void |
2601 | slf_destroy (pTHX_ struct coro *coro) |
2602 | slf_destroy (pTHX_ struct coro *coro) |
2602 | { |
2603 | { |
2603 | /* this callback is reserved for slf functions needing to do cleanup */ |
2604 | struct CoroSLF frame = coro->slf_frame; |
2604 | if (coro->slf_frame.destroy && coro->slf_frame.prepare && !PL_dirty) |
|
|
2605 | coro->slf_frame.destroy (aTHX_ &coro->slf_frame); |
|
|
2606 | |
2605 | |
2607 | /* |
2606 | /* |
2608 | * The on_destroy above most likely is from an SLF call. |
2607 | * The on_destroy below most likely is from an SLF call. |
2609 | * 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 |
2610 | * the coro, we will have to force-finish it here, otherwise |
2609 | * the coro, we will have to force-finish it here, otherwise |
2611 | * cleanup functions cannot call SLF functions. |
2610 | * cleanup functions cannot call SLF functions. |
2612 | */ |
2611 | */ |
2613 | 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); |
2614 | } |
2618 | } |
2615 | |
2619 | |
2616 | /* |
2620 | /* |
2617 | * these not obviously related functions are all rolled into one |
2621 | * these not obviously related functions are all rolled into one |
2618 | * 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 |