… | |
… | |
74 | |
74 | |
75 | our $idle; # idle handler |
75 | our $idle; # idle handler |
76 | our $main; # main coroutine |
76 | our $main; # main coroutine |
77 | our $current; # current coroutine |
77 | our $current; # current coroutine |
78 | |
78 | |
79 | our $VERSION = 5.12; |
79 | our $VERSION = 5.13; |
80 | |
80 | |
81 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
81 | our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); |
82 | our %EXPORT_TAGS = ( |
82 | our %EXPORT_TAGS = ( |
83 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
83 | prio => [qw(PRIO_MAX PRIO_HIGH PRIO_NORMAL PRIO_LOW PRIO_IDLE PRIO_MIN)], |
84 | ); |
84 | ); |
… | |
… | |
315 | Terminates the current coroutine with the given status values (see L<cancel>). |
315 | Terminates the current coroutine with the given status values (see L<cancel>). |
316 | |
316 | |
317 | =item killall |
317 | =item killall |
318 | |
318 | |
319 | Kills/terminates/cancels all coroutines except the currently running |
319 | Kills/terminates/cancels all coroutines except the currently running |
320 | one. This is useful after a fork, either in the child or the parent, as |
320 | one. This can be useful after a fork, either in the child or the parent, |
321 | usually only one of them should inherit the running coroutines. |
321 | as usually only one of them should inherit the running coroutines. |
|
|
322 | |
|
|
323 | Note that in the implementation, destructors run as normal, making this |
|
|
324 | function not so useful after a fork. Future versions of this function |
|
|
325 | might try to free resources without running any code. |
322 | |
326 | |
323 | Note that while this will try to free some of the main programs resources, |
327 | Note that while this will try to free some of the main programs resources, |
324 | you cannot free all of them, so if a coroutine that is not the main |
328 | you cannot free all of them, so if a coroutine that is not the main |
325 | program calls this function, there will be some one-time resource leak. |
329 | program calls this function, there will be some one-time resource leak. |
326 | |
330 | |