release-1.10release-1.8release-1.9
|
Last change
on this file since ede073c was
21bab95,
checked in by Nelson Elhage <nelhage@mit.edu>, 15 years ago
|
|
Fix some bugs in asedeno's AnyEvent implementation.
|
-
Property mode set to
100644
|
|
File size:
749 bytes
|
| Line | |
|---|
| 1 | use strict; |
|---|
| 2 | use warnings; |
|---|
| 3 | package BarnOwl::AnyEvent; |
|---|
| 4 | use BarnOwl::Timer; |
|---|
| 5 | |
|---|
| 6 | sub io { |
|---|
| 7 | my ($class, %arg) = @_; |
|---|
| 8 | my $fd = fileno($arg{fh}); |
|---|
| 9 | my $mode = $arg{poll}; |
|---|
| 10 | my $cb = $arg{cb}; |
|---|
| 11 | my $self = {cb => $cb, |
|---|
| 12 | mode => $mode, |
|---|
| 13 | fd => $fd }; |
|---|
| 14 | bless($self, $class); |
|---|
| 15 | $self->{dispatch} = BarnOwl::add_io_dispatch($fd, $mode, $cb); |
|---|
| 16 | return $self; |
|---|
| 17 | } |
|---|
| 18 | |
|---|
| 19 | sub BarnOwl::AnyEvent::io::DESTROY |
|---|
| 20 | { |
|---|
| 21 | my ($self) = @_; |
|---|
| 22 | BarnOwl::remove_io_dispatch($self->{fd}); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | sub timer { |
|---|
| 26 | my ($class, %arg) = @_; |
|---|
| 27 | return BarnOwl::Timer->new(\%arg); |
|---|
| 28 | } |
|---|
| 29 | |
|---|
| 30 | sub DESTROY { } |
|---|
| 31 | |
|---|
| 32 | # sub idle { |
|---|
| 33 | # my ($class, %arg) = @_; |
|---|
| 34 | # my $cb = $arg{cb}; |
|---|
| 35 | # } |
|---|
| 36 | |
|---|
| 37 | # sub child { |
|---|
| 38 | # my ($class, %arg) = @_; |
|---|
| 39 | # my $cb = $arg{cb}; |
|---|
| 40 | # } |
|---|
| 41 | |
|---|
| 42 | 1; |
|---|
Note: See
TracBrowser
for help on using the repository browser.