Coro is a large Perl module family that implements cooperative multitasking in Perl. It supports filehandle and event abstraction and also implements continuations as well as the necessary directives to implement a slightly limited call/cc in Perl.
Unlike the so-called "Perl threads/fork emulation", they provide a real shared address space (like real threads) without the associated race conditions and performance loss, while maintaining a very low memory overhead (2-3kb/coroutine). The package comes with examples and many supporting modules.
SYNOPSIS
use Coro;
async {
# some asynchronous thread of execution
print "2n";
cede; # yield back to main
print "4n";
};
print "1n";
cede; # yield to coroutine
print "3n";
cede; # and again
# use locking
my $lock = new Coro::Semaphore;
my $locked;
$lock->down;
$locked = 1;
$lock->up;
Requirements:
· Perl