ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/Impl/Event.pm
Revision: 1.11
Committed: Fri Nov 24 14:40:13 2006 UTC (17 years, 7 months ago) by root
Branch: MAIN
Changes since 1.10: +5 -1 lines
Log Message:
*** empty log message ***

File Contents

# 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.10 bless \(my $x = Event->io (%arg)), $class
9 root 1.2 }
10    
11     sub timer {
12     my ($class, %arg) = @_;
13 root 1.10 my $cb = delete $arg{cb};
14 root 1.8 bless \(my $w = Event->timer (
15 root 1.2 %arg,
16     cb => sub {
17 root 1.6 $_[0]->w->cancel;
18 root 1.7 $cb->();
19 root 1.2 },
20     )), $class
21     }
22    
23 root 1.7 sub DESTROY {
24 root 1.9 ${$_[0]}->cancel;
25 root 1.1 }
26    
27 root 1.2 sub condvar {
28 root 1.1 my $class = shift;
29    
30 root 1.7 bless \my $flag, $class
31 root 1.1 }
32    
33 root 1.7 sub broadcast {
34 root 1.3 ${$_[0]}++;
35 root 1.1 }
36    
37 root 1.7 sub wait {
38 root 1.11 Event::one_event while !${$_[0]};
39     }
40    
41     sub one_event {
42     Event::one_event;
43 root 1.1 }
44    
45 root 1.2 1
46 root 1.1