threads::liteErlang style threading library | |
Download |
threads::lite Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Leon Timmermans
- Publisher web site:
- http://search.cpan.org/~leont/
threads::lite Tags
threads::lite Description
Erlang style threading library threads::lite is a Perl module that implements threads. One crucial difference with normal threads is that the threads are disconnected, except by message queues (channel). It thus facilitates a message passing style of multi-threading.SYNOPSIS use Modern::Perl; use threads::lite qw/spawn self receive receive_table/; sub child { my $other = threads::lite::receive; while (< >) { chomp; $other- >send(line => $_); } } my $child = spawn({ monitor = > 1 } , \&child); $child- >send(self); my $continue = 1; while ($continue) { receive_table( = > sub { my (undef, $line) = @_; say "received line: $line"; }, => sub { say "received end of file"; $continue = 0; }, [] => sub { die sprintf "Got unknown message: (%s)", join ", ", @_; }, ); }; Requirements: · Perl
threads::lite Related Software