ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/Coro/Timer.pm
(Generate patch)

Comparing Coro/Coro/Timer.pm (file contents):
Revision 1.35 by root, Fri Apr 25 04:28:50 2008 UTC vs.
Revision 1.36 by root, Sat May 10 00:36:00 2008 UTC

10 sleep 10; 10 sleep 10;
11 11
12=head1 DESCRIPTION 12=head1 DESCRIPTION
13 13
14This package implements a simple timer callback system which works 14This package implements a simple timer callback system which works
15independent of the event loop mechanism used. If no event mechanism is 15independent of the event loop mechanism used.
16used, it is emulated. The C<Coro::Event> module overwrites functions with
17versions better suited.
18
19This module is not subclassable.
20 16
21=over 4 17=over 4
22 18
23=cut 19=cut
24 20
27no warnings; 23no warnings;
28 24
29use Carp (); 25use Carp ();
30use Exporter; 26use Exporter;
31 27
28use AnyEvent ();
29
32use Coro (); 30use Coro ();
33use AnyEvent (); 31use Coro::AnyEvent ();
34 32
35$VERSION = 4.6; 33$VERSION = 4.6;
36@EXPORT_OK = qw(timeout sleep); 34@EXPORT_OK = qw(timeout sleep);
37 35
38=item $flag = timeout $seconds; 36=item $flag = timeout $seconds;
92 }); 90 });
93 91
94 do { &Coro::schedule } while $current; 92 do { &Coro::schedule } while $current;
95} 93}
96 94
97$Coro::idle = sub {
98 AnyEvent->one_event;
99};
100
1011; 951;
102 96
103=back 97=back
104 98
105=head1 AUTHOR 99=head1 AUTHOR

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines