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

Comparing AnyEvent/lib/AnyEvent/Impl/Glib.pm (file contents):
Revision 1.18 by root, Tue Jul 8 19:33:40 2008 UTC vs.
Revision 1.19 by root, Tue Jul 8 23:10:20 2008 UTC

39our $maincontext = Glib::MainContext->default; 39our $maincontext = Glib::MainContext->default;
40 40
41sub io { 41sub io {
42 my ($class, %arg) = @_; 42 my ($class, %arg) = @_;
43 43
44 my $fh = $arg{fh};
45 my $cb = $arg{cb}; 44 my $cb = $arg{cb};
46 45
47 my @cond; 46 my @cond;
48 # some glibs need hup, others error with it, YMMV 47 # some glibs need hup, others error with it, YMMV
49 push @cond, "in", "hup" if $arg{poll} eq "r"; 48 push @cond, "in", "hup" if $arg{poll} eq "r";
50 push @cond, "out", "hup" if $arg{poll} eq "w"; 49 push @cond, "out", "hup" if $arg{poll} eq "w";
51 50
52 my $source = add_watch Glib::IO fileno $arg{fh}, \@cond, sub { 51 my $source = add_watch Glib::IO fileno $arg{fh}, \@cond, sub {
53 &$cb; 52 &$cb;
54 $fh; # mention it here to keep it from being destroyed
55 1 53 1
56 }; 54 };
57 55
58 bless \\$source, $class 56 bless \\$source, $class
59} 57}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines