ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Util.pm
(Generate patch)

Comparing Coro/Coro/Util.pm (file contents):
Revision 1.58 by root, Tue Jul 28 02:04:21 2009 UTC vs.
Revision 1.59 by root, Sat Aug 22 22:36:23 2009 UTC

37use base 'Exporter'; 37use base 'Exporter';
38 38
39our @EXPORT = qw(gethostbyname gethostbyaddr); 39our @EXPORT = qw(gethostbyname gethostbyaddr);
40our @EXPORT_OK = qw(inet_aton fork_eval); 40our @EXPORT_OK = qw(inet_aton fork_eval);
41 41
42our $VERSION = 5.162; 42our $VERSION = 5.17;
43 43
44our $MAXPARALLEL = 16; # max. number of parallel jobs 44our $MAXPARALLEL = 16; # max. number of parallel jobs
45 45
46my $jobs = new Coro::Semaphore $MAXPARALLEL; 46my $jobs = new Coro::Semaphore $MAXPARALLEL;
47 47
59 Coro::State::_exit 0; 59 Coro::State::_exit 0;
60 } 60 }
61 61
62 my $buf; 62 my $buf;
63 my $wakeup = Coro::rouse_cb; 63 my $wakeup = Coro::rouse_cb;
64 my $w; $w = AnyEvent->io (fh => $fh, poll => 'r', cb => sub { 64 my $w; $w = AE::io $fh, 0, sub {
65 sysread $fh, $buf, 16384, length $buf 65 sysread $fh, $buf, 16384, length $buf
66 and return; 66 and return;
67 67
68 undef $w; 68 undef $w;
69 $wakeup->(); 69 $wakeup->();
70 }); 70 };
71 71
72 Coro::rouse_wait; 72 Coro::rouse_wait;
73 73
74 $jobs->up; 74 $jobs->up;
75 my @r = map { pack "H*", $_ } split /\0/, $buf; 75 my @r = map { pack "H*", $_ } split /\0/, $buf;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines