Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created December 4, 2012 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tadzik/4205805 to your computer and use it in GitHub Desktop.
Save tadzik/4205805 to your computer and use it in GitHub Desktop.
┌─[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