Created
December 4, 2012 16:30
-
-
Save tadzik/4205836 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
┌─[tadzik@yavin4]─[~/src/perl/Coro] | |
└─[%]─> cat test.pl | |
use lib 'lib'; | |
use Coroutines; | |
async { | |
# some asynchronous thread of execution | |
say 2; | |
yield; # yield back to main | |
say 4 | |
}; | |
say 1; | |
sched; # jump to async block | |
say 3; | |
sched; # and again | |
say 5; | |
sched; # this would do nothing, all coroutines are exhausted | |
say 6; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment