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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.168 by root, Tue Jul 8 23:53:37 2008 UTC vs.
Revision 1.169 by root, Wed Jul 9 10:36:22 2008 UTC

963 963
964 my $class = shift; 964 my $class = shift;
965 $class->$func (@_); 965 $class->$func (@_);
966} 966}
967 967
968# utility function to dup a filehandle. this is used by many backends
969# to support binding more than one watcher per filehandle (they usually
970# allow only one watcher per fd, so we dup it to get a different one).
971sub _dupfh($$$$) {
972 my ($poll, $fh, $r, $w) = @_;
973
974 require Fcntl;
975
976 # cygwin requires the fh mode to be matching, unix doesn't
977 my ($rw, $mode) = $poll eq "r" ? ($r, "<")
978 : $poll eq "w" ? ($w, ">")
979 : Carp::croak "AnyEvent->io requires poll set to either 'r' or 'w'";
980
981 open my $fh2, "$mode&" . fileno $fh
982 or die "cannot dup() filehandle: $!";
983
984 # we assume CLOEXEC is already set by perl in all important cases
985
986 ($fh2, $rw)
987}
988
968package AnyEvent::Base; 989package AnyEvent::Base;
969 990
970# default implementation for now and time 991# default implementation for now and time
971 992
972use Time::HiRes (); 993use Time::HiRes ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines