Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created December 4, 2012 16:30
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/4205836 to your computer and use it in GitHub Desktop.
Save tadzik/4205836 to your computer and use it in GitHub Desktop.
┌─[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