Skip Menu |

This queue is for tickets about the IO-Epoll CPAN distribution.

Report information
The Basics
Id: 42729
Status: resolved
Priority: 0/
Queue: IO-Epoll

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: IO::Poll-compatibility fixes
These patches fix the following bugs: * Ensure that the ->poll method returns -1 on error, rather than returning undef * Ensure that ->poll interprets its timeout value in seconds, as IO::Poll does, rather than miliseconds, as epoll_wait() does -- Paul Evans
Subject: IO-Epoll_poll-error.diff
=== modified file 'lib/IO/Epoll.pm' --- lib/IO/Epoll.pm 2008-11-23 16:51:59 +0000 +++ lib/IO/Epoll.pm 2008-11-23 17:35:55 +0000 @@ -182,7 +182,7 @@ my $msec = defined $timeout ? $timeout * 1000 : -1; my $ret = epoll_wait($self->[3], $maxevents, $msec); - return $ret if $ret < 0; + return -1 unless defined $ret; foreach my $event (@$ret) { $self->[1]{$event->[0]} = $event->[1];
Subject: IO-Epoll_timeout-msec.diff
=== modified file 'lib/IO/Epoll.pm' --- lib/IO/Epoll.pm 2008-11-21 19:49:40 +0000 +++ lib/IO/Epoll.pm 2008-11-23 16:51:59 +0000 @@ -179,7 +179,9 @@ my $maxevents = int ((values %{ $self->[0] }) / 2); $maxevents = 10 if $maxevents < 10; - my $ret = epoll_wait($self->[3], $maxevents, $timeout); + my $msec = defined $timeout ? $timeout * 1000 : -1; + + my $ret = epoll_wait($self->[3], $maxevents, $msec); return $ret if $ret < 0; foreach my $event (@$ret) { @@ -389,7 +391,7 @@ Call the system level poll routine. If TIMEOUT is not specified then the call will block. Returns the number of handles which had events -happen, or -1 on error. +happen, or -1 on error. TIMEOUT is in seconds and may be fractional. =item events ( IO ) === modified file 't/IO-Poll-compat.t' --- t/IO-Poll-compat.t 2008-11-21 19:49:40 +0000 +++ t/IO-Poll-compat.t 2008-11-21 20:00:43 +0000 @@ -17,10 +17,11 @@ select(STDERR); $| = 1; select(STDOUT); $| = 1; -print "1..10\n"; +print "1..11\n"; use IO::Handle; use IO::Epoll qw(:compat); +use Time::HiRes qw( time ); my $poll = new IO::Epoll; @@ -90,3 +91,17 @@ print "not " if $poll->poll(0.1); print "ok 10\n"; + +my $starttime = time(); + +$poll->poll( 1.000 ); + +my $duration = time() - $starttime; +if( $duration < 0.9 or $duration > 1.5 ) { + print "not ok 11 # poll(1.000) took "; + print "more than 1.5 seconds ($duration)\n" if $duration > 1.5; + print "less than 0.9 seconds ($duration)\n" if $duration < 0.9; +} +else { + print "ok 11\n"; +}
On Fri Jan 23 13:05:23 2009, PEVANS wrote: Show quoted text
> These patches fix the following bugs: > > * Ensure that the ->poll method returns -1 on error, rather than > returning undef > > * Ensure that ->poll interprets its timeout value in seconds, as > IO::Poll does, rather than miliseconds, as epoll_wait() does
This is now fixed in 0.02 from CPAN. Thanks. -- Paul Evans