… | |
… | |
2608 | * 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 |
2609 | * the coro, we will have to force-finish it here, otherwise |
2609 | * the coro, we will have to force-finish it here, otherwise |
2610 | * cleanup functions cannot call SLF functions. |
2610 | * cleanup functions cannot call SLF functions. |
2611 | */ |
2611 | */ |
2612 | coro->slf_frame.prepare = 0; |
2612 | coro->slf_frame.prepare = 0; |
2613 | coro->slf_frame.destroy = 0; |
|
|
2614 | |
2613 | |
2615 | /* this callback is reserved for slf functions needing to do cleanup */ |
2614 | /* this callback is reserved for slf functions needing to do cleanup */ |
2616 | if (frame.destroy && frame.prepare && !PL_dirty) |
2615 | if (frame.destroy && frame.prepare && !PL_dirty) |
2617 | frame.destroy (aTHX_ &frame); |
2616 | frame.destroy (aTHX_ &frame); |
2618 | } |
2617 | } |
… | |
… | |
2962 | { |
2961 | { |
2963 | AV *av = (AV *)frame->data; |
2962 | AV *av = (AV *)frame->data; |
2964 | SV *count_sv = AvARRAY (av)[0]; |
2963 | SV *count_sv = AvARRAY (av)[0]; |
2965 | SV *coro_hv = SvRV (coro_current); |
2964 | SV *coro_hv = SvRV (coro_current); |
2966 | |
2965 | |
|
|
2966 | frame->destroy = 0; |
|
|
2967 | |
2967 | /* if we are about to throw, don't actually acquire the lock, just throw */ |
2968 | /* if we are about to throw, don't actually acquire the lock, just throw */ |
2968 | if (CORO_THROW) |
2969 | if (ecb_expect_false (CORO_THROW)) |
|
|
2970 | { |
|
|
2971 | /* we still might be responsible for the semaphore, so wake up others */ |
|
|
2972 | coro_semaphore_adjust (aTHX_ av, 0); |
|
|
2973 | |
2969 | return 0; |
2974 | return 0; |
|
|
2975 | } |
2970 | else if (SvIVX (count_sv) > 0) |
2976 | else if (SvIVX (count_sv) > 0) |
2971 | { |
2977 | { |
2972 | frame->destroy = 0; |
|
|
2973 | |
|
|
2974 | if (acquire) |
2978 | if (acquire) |
2975 | SvIVX (count_sv) = SvIVX (count_sv) - 1; |
2979 | SvIVX (count_sv) = SvIVX (count_sv) - 1; |
2976 | else |
2980 | else |
2977 | coro_semaphore_adjust (aTHX_ av, 0); |
2981 | coro_semaphore_adjust (aTHX_ av, 0); |
2978 | |
2982 | |