… | |
… | |
474 | reentrancy). This means you must not block within event callbacks, |
474 | reentrancy). This means you must not block within event callbacks, |
475 | otherwise you might suffer from crashes or worse. The only event |
475 | otherwise you might suffer from crashes or worse. The only event |
476 | library currently known that is safe to use without "unblock_sub" is |
476 | library currently known that is safe to use without "unblock_sub" is |
477 | EV. |
477 | EV. |
478 | |
478 | |
|
|
479 | Coro will try to catch you when you block in the event loop |
|
|
480 | ("FATAL:$Coro::IDLE blocked itself"), but this is just best effort |
|
|
481 | and only works when you do not run your own event loop. |
|
|
482 | |
479 | This function allows your callbacks to block by executing them in |
483 | This function allows your callbacks to block by executing them in |
480 | another coro where it is safe to block. One example where blocking |
484 | another coro where it is safe to block. One example where blocking |
481 | is handy is when you use the Coro::AIO functions to save results to |
485 | is handy is when you use the Coro::AIO functions to save results to |
482 | disk, for example. |
486 | disk, for example. |
483 | |
487 | |
… | |
… | |
595 | unix roughly halves perl performance, even when not used. |
599 | unix roughly halves perl performance, even when not used. |
596 | |
600 | |
597 | coro switching is not signal safe |
601 | coro switching is not signal safe |
598 | You must not switch to another coro from within a signal handler |
602 | You must not switch to another coro from within a signal handler |
599 | (only relevant with %SIG - most event libraries provide safe |
603 | (only relevant with %SIG - most event libraries provide safe |
600 | signals). |
604 | signals), *unless* you are sure you are not interrupting a Coro |
|
|
605 | function. |
601 | |
606 | |
602 | That means you *MUST NOT* call any function that might "block" the |
607 | That means you *MUST NOT* call any function that might "block" the |
603 | current coro - "cede", "schedule" "Coro::Semaphore->down" or |
608 | current coro - "cede", "schedule" "Coro::Semaphore->down" or |
604 | anything that calls those. Everything else, including calling |
609 | anything that calls those. Everything else, including calling |
605 | "ready", works. |
610 | "ready", works. |