ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro.pm
(Generate patch)

Comparing Coro/Coro.pm (file contents):
Revision 1.281 by root, Tue Dec 7 17:13:43 2010 UTC vs.
Revision 1.282 by root, Sun Dec 26 16:23:51 2010 UTC

671returning a new coderef. Unblocking means that calling the new coderef 671returning a new coderef. Unblocking means that calling the new coderef
672will return immediately without blocking, returning nothing, while the 672will return immediately without blocking, returning nothing, while the
673original code ref will be called (with parameters) from within another 673original code ref will be called (with parameters) from within another
674coro. 674coro.
675 675
676The reason this function exists is that many event libraries (such as the 676The reason this function exists is that many event libraries (such as
677venerable L<Event|Event> module) are not thread-safe (a weaker form 677the venerable L<Event|Event> module) are not thread-safe (a weaker form
678of reentrancy). This means you must not block within event callbacks, 678of reentrancy). This means you must not block within event callbacks,
679otherwise you might suffer from crashes or worse. The only event library 679otherwise you might suffer from crashes or worse. The only event library
680currently known that is safe to use without C<unblock_sub> is L<EV>. 680currently known that is safe to use without C<unblock_sub> is L<EV> (but
681you might still run into deadlocks if all event loops are blocked).
681 682
682Coro will try to catch you when you block in the event loop 683Coro will try to catch you when you block in the event loop
683("FATAL:$Coro::IDLE blocked itself"), but this is just best effort and 684("FATAL:$Coro::IDLE blocked itself"), but this is just best effort and
684only works when you do not run your own event loop. 685only works when you do not run your own event loop.
685 686

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines