… | |
… | |
85 | What you I<MUST NOT EVER DO> is to block inside an event loop |
85 | What you I<MUST NOT EVER DO> is to block inside an event loop |
86 | callback. The reason is that most event loops are not reentrant and |
86 | callback. The reason is that most event loops are not reentrant and |
87 | this can cause a deadlock at best and corrupt memory at worst. |
87 | this can cause a deadlock at best and corrupt memory at worst. |
88 | |
88 | |
89 | Coro will try to catch you when you block in the event loop |
89 | Coro will try to catch you when you block in the event loop |
90 | ("FATAL:$Coro::IDLE blocked itself"), but this is just best effort and |
90 | ("FATAL: $Coro::IDLE blocked itself"), but this is just best effort and |
91 | only works when you do not run your own event loop. |
91 | only works when you do not run your own event loop. |
92 | |
92 | |
93 | To avoid this problem, simply do not block inside an event callback |
93 | To avoid this problem, simply do not block inside an event callback |
94 | - start a new thread (e.g. with C<Coro:async_pool>) or use |
94 | - start a new thread (e.g. with C<Coro:async_pool>) or use |
95 | C<Coro::unblock_sub>. |
95 | C<Coro::unblock_sub>. |