Revision: | 1.8 |
Committed: | Mon Oct 30 21:41:15 2006 UTC (17 years, 8 months ago) by root |
Branch: | MAIN |
Changes since 1.7: | +2 -6 lines |
Log Message: | *** empty log message *** |
# | User | Rev | Content |
---|---|---|---|
1 | root | 1.1 | package AnyEvent::Impl::Event; |
2 | |||
3 | use Event (); | ||
4 | |||
5 | root | 1.2 | sub io { |
6 | my ($class, %arg) = @_; | ||
7 | $arg{fd} = delete $arg{fh}; | ||
8 | root | 1.1 | bless \(my $x = Event->io ( |
9 | root | 1.2 | %arg, |
10 | root | 1.7 | cb => $arg{cb}, |
11 | root | 1.2 | )), $class |
12 | } | ||
13 | |||
14 | sub timer { | ||
15 | my ($class, %arg) = @_; | ||
16 | root | 1.7 | my $cb = $arg{cb}; |
17 | root | 1.8 | bless \(my $w = Event->timer ( |
18 | root | 1.2 | %arg, |
19 | cb => sub { | ||
20 | root | 1.6 | $_[0]->w->cancel; |
21 | root | 1.7 | $cb->(); |
22 | root | 1.2 | }, |
23 | )), $class | ||
24 | } | ||
25 | |||
26 | root | 1.7 | sub DESTROY { |
27 | root | 1.8 | $_[0]->cancel; |
28 | root | 1.1 | } |
29 | |||
30 | root | 1.2 | sub condvar { |
31 | root | 1.1 | my $class = shift; |
32 | |||
33 | root | 1.7 | bless \my $flag, $class |
34 | root | 1.1 | } |
35 | |||
36 | root | 1.7 | sub broadcast { |
37 | root | 1.3 | ${$_[0]}++; |
38 | root | 1.1 | } |
39 | |||
40 | root | 1.7 | sub wait { |
41 | root | 1.2 | Event::one_event() while !${$_[0]}; |
42 | root | 1.1 | } |
43 | |||
44 | root | 1.2 | 1 |
45 | root | 1.1 |