AnyEvent::Fork::Pool and event processing in workers
Andrey Khlopenov
khlopenov.andrey at gmail.com
Fri Jan 10 22:20:44 CET 2014
Hi.
Are AnyEvent::Fork::Pool has ability to process events in workers?
If yes, why this simple code isn't work?
<code>
#!/usr/bin/perl
use strict;
use warnings;
use AnyEvent::Fork::Pool;
my $pool = AnyEvent::Fork
->new
->require("AnyEvent")
->eval('
sub run {
my ($cb, $id) = @_;
my $n;
my $timer; $timer = AE::timer 0, 1, sub {
print $id, "\n";
$cb->() if (++$n == 3);
};
}
')
->AnyEvent::Fork::Pool::run(
"run",
max => 8,
load => 1,
on_destroy => (my $finish = AE::cv),
async => 1,
on_error => sub { die "FATAL: $_[0]\n"; }
)
;
foreach (1 .. 8) {
$pool->($_, sub {});
}
undef $pool;
$finish->recv;
</code>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.schmorp.de/pipermail/anyevent/attachments/20140110/a8531d18/attachment.html>
More information about the anyevent
mailing list