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

Comparing cvsroot/Coro/Coro.pm (file contents):
Revision 1.120 by root, Fri Apr 13 03:57:15 2007 UTC vs.
Revision 1.122 by root, Sat Apr 14 15:06:05 2007 UTC

185 185
186Create a new asynchronous coroutine and return it's coroutine object 186Create a new asynchronous coroutine and return it's coroutine object
187(usually unused). When the sub returns the new coroutine is automatically 187(usually unused). When the sub returns the new coroutine is automatically
188terminated. 188terminated.
189 189
190Calling C<exit> in a coroutine will not work correctly, so do not do that. 190Calling C<exit> in a coroutine will do the same as calling exit outside
191 191the coroutine. Likewise, when the coroutine dies, the program will exit,
192When the coroutine dies, the program will exit, just as in the main 192just as it would in the main program.
193program.
194 193
195 # create a new coroutine that just prints its arguments 194 # create a new coroutine that just prints its arguments
196 async { 195 async {
197 print "@_\n"; 196 print "@_\n";
198 } 1,2,3,4; 197 } 1,2,3,4;
326Create a new coroutine and return it. When the sub returns the coroutine 325Create a new coroutine and return it. When the sub returns the coroutine
327automatically terminates as if C<terminate> with the returned values were 326automatically terminates as if C<terminate> with the returned values were
328called. To make the coroutine run you must first put it into the ready queue 327called. To make the coroutine run you must first put it into the ready queue
329by calling the ready method. 328by calling the ready method.
330 329
331Calling C<exit> in a coroutine will not work correctly, so do not do that. 330See C<async> for additional discussion.
332 331
333=cut 332=cut
334 333
335sub _run_coro { 334sub _run_coro {
336 terminate &{+shift}; 335 terminate &{+shift};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines