--- Coro/Coro.pm 2008/05/31 12:10:55 1.191 +++ Coro/Coro.pm 2008/09/21 01:23:26 1.198 @@ -18,6 +18,7 @@ cede; # and again # use locking + use Coro::Semaphore; my $lock = new Coro::Semaphore; my $locked; @@ -68,7 +69,7 @@ our $main; # main coroutine our $current; # current coroutine -our $VERSION = 4.742; +our $VERSION = 4.746; our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); our %EXPORT_TAGS = ( @@ -83,7 +84,7 @@ This variable stores the coroutine object that represents the main program. While you cna C it and do most other things you can do to coroutines, it is mainly useful to compare again C<$Coro::current>, to see -wether you are running in the main program or not. +whether you are running in the main program or not. =cut @@ -268,8 +269,10 @@ } }; - last if $@ eq "\3async_pool terminate\2\n"; - warn $@ if $@; + if ($@) { + last if $@ eq "\3async_pool terminate\2\n"; + warn $@; + } } } @@ -309,7 +312,7 @@ a variable, then arrange for some callback of yours to call C<< ->ready >> on that once some event happens, and last you call C to put yourself to sleep. Note that a lot of things can wake your coroutine up, -so you need to check wether the event indeed happened, e.g. by storing the +so you need to check whether the event indeed happened, e.g. by storing the status in a variable. The canonical way to wait on external events is this: @@ -358,7 +361,7 @@ usually only one of them should inherit the running coroutines. Note that while this will try to free some of the main programs resources, -you cnanot free all of them, so if a coroutine that is not the main +you cannot free all of them, so if a coroutine that is not the main program calls this function, there will be some one-time resource leak. =cut @@ -417,7 +420,7 @@ =item $is_ready = $coroutine->is_ready -Return wether the coroutine is currently the ready queue or not, +Return whether the coroutine is currently the ready queue or not, =item $coroutine->cancel (arg...)