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

Comparing Coro/Coro.pm (file contents):
Revision 1.239 by root, Mon Nov 24 07:55:28 2008 UTC vs.
Revision 1.240 by root, Tue Nov 25 20:48:41 2008 UTC

74 74
75our $idle; # idle handler 75our $idle; # idle handler
76our $main; # main coroutine 76our $main; # main coroutine
77our $current; # current coroutine 77our $current; # current coroutine
78 78
79our $VERSION = 5.1; 79our $VERSION = 5.11;
80 80
81our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub); 81our @EXPORT = qw(async async_pool cede schedule terminate current unblock_sub);
82our %EXPORT_TAGS = ( 82our %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);
175 175
176=over 4 176=over 4
177 177
178=item async { ... } [@args...] 178=item async { ... } [@args...]
179 179
180Create a new coroutine and return it's coroutine object (usually 180Create a new coroutine and return its coroutine object (usually
181unused). The coroutine will be put into the ready queue, so 181unused). The coroutine will be put into the ready queue, so
182it will start running automatically on the next scheduler run. 182it will start running automatically on the next scheduler run.
183 183
184The first argument is a codeblock/closure that should be executed in the 184The first argument is a codeblock/closure that should be executed in the
185coroutine. When it returns argument returns the coroutine is automatically 185coroutine. When it returns argument returns the coroutine is automatically
681 681
682Coro offers two functions specifically designed to make this easy, 682Coro offers two functions specifically designed to make this easy,
683C<Coro::rouse_cb> and C<Coro::rouse_wait>. 683C<Coro::rouse_cb> and C<Coro::rouse_wait>.
684 684
685The first function, C<rouse_cb>, generates and returns a callback that, 685The first function, C<rouse_cb>, generates and returns a callback that,
686when invoked, will save it's arguments and notify the coroutine that 686when invoked, will save its arguments and notify the coroutine that
687created the callback. 687created the callback.
688 688
689The second function, C<rouse_wait>, waits for the callback to be called 689The second function, C<rouse_wait>, waits for the callback to be called
690(by calling C<schedule> to go to sleep) and returns the arguments 690(by calling C<schedule> to go to sleep) and returns the arguments
691originally passed to the callback. 691originally passed to the callback.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines