Created
December 4, 2012 16:26
-
-
Save tadzik/4205805 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 Coro; | |
async { | |
# some asynchronous thread of execution | |
print "2\n"; | |
yield; # yield back to main | |
print "4\n"; | |
}; | |
print "1\n"; | |
cede; # yield to coro | |
print "3\n"; | |
cede; # and again | |
┌─[tadzik@yavin4]─[~/src/perl/Coro] | |
└─[%]─> perl6 test.pl | |
1 | |
2 | |
3 | |
4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment