1 | package AnyEvent::Impl::Glib; |
1 | package AnyEvent::Impl::Glib; |
2 | |
2 | |
3 | no warnings; |
3 | no warnings; |
|
|
4 | use strict; |
4 | |
5 | |
5 | use Glib (); |
6 | use Glib (); |
6 | |
7 | |
7 | my $maincontext = Glib::MainContext->default; |
8 | my $maincontext = Glib::MainContext->default; |
8 | |
9 | |
… | |
… | |
10 | my ($class, %arg) = @_; |
11 | my ($class, %arg) = @_; |
11 | |
12 | |
12 | my $self = bless \%arg, $class; |
13 | my $self = bless \%arg, $class; |
13 | my $rcb = \$self->{cb}; |
14 | my $rcb = \$self->{cb}; |
14 | |
15 | |
|
|
16 | my @cond; |
15 | # some glibs need hup, others error with it, YMMV |
17 | # some glibs need hup, others error with it, YMMV |
16 | push @cond, "in", "hup" if $self->{poll} eq "r"; |
18 | push @cond, "in", "hup" if $self->{poll} eq "r"; |
17 | push @cond, "out", "hup" if $self->{poll} eq "w"; |
19 | push @cond, "out", "hup" if $self->{poll} eq "w"; |
18 | |
20 | |
19 | $self->{source} = add_watch Glib::IO fileno $self->{fh}, \@cond, sub { |
21 | $self->{source} = add_watch Glib::IO fileno $self->{fh}, \@cond, sub { |