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

Comparing Coro/Event/Event.pm (file contents):
Revision 1.41 by root, Fri Dec 1 02:17:37 2006 UTC vs.
Revision 1.42 by root, Fri Dec 1 02:24:46 2006 UTC

37Please note that even programs or modules (such as 37Please note that even programs or modules (such as
38L<Coro::Handle|Coro::Handle>) that use "traditional" 38L<Coro::Handle|Coro::Handle>) that use "traditional"
39event-based/continuation style will run more efficient with this module 39event-based/continuation style will run more efficient with this module
40then when using only Event. 40then when using only Event.
41 41
42=head1 WARNING
43
44Please note that Event does not support coroutines or threads. That
45means that you B<MUST NOT> block in an event callback. Again: In Event
46callbacks, you I<must never ever> call a Coroutine fucntion that blocks
47the current coroutine.
48
49While this seems to work superficially, it will eventually cause memory
50corruption.
51
52=head1 FUNCTIONS
53
42=over 4 54=over 4
43 55
44=cut 56=cut
45 57
46package Coro::Event; 58package Coro::Event;
47 59
48BEGIN { eval { require warnings } && warnings->unimport ("uninitialized") } 60no warnings;
49 61
50use Carp; 62use Carp;
51no warnings; 63no warnings;
52 64
53use Coro; 65use Coro;
65 77
66 local $^W = 0; # avoid redefine warning for Coro::ready; 78 local $^W = 0; # avoid redefine warning for Coro::ready;
67 XSLoader::load __PACKAGE__, $VERSION; 79 XSLoader::load __PACKAGE__, $VERSION;
68} 80}
69 81
70=item $w = Coro::Event->flavour(args...) 82=item $w = Coro::Event->flavour (args...)
71 83
72Create and return a watcher of the given type. 84Create and return a watcher of the given type.
73 85
74Examples: 86Examples:
75 87
82 94
83Return the next event of the event queue of the watcher. 95Return the next event of the event queue of the watcher.
84 96
85=cut 97=cut
86 98
87=item do_flavour(args...) 99=item do_flavour args...
88 100
89Create a watcher of the given type and immediately call it's next 101Create a watcher of the given type and immediately call it's next
90method. This is less efficient then calling the constructor once and the 102method. This is less efficient then calling the constructor once and the
91next method often, but it does save typing sometimes. 103next method often, but it does save typing sometimes.
92 104
147into the Event dispatcher. 159into the Event dispatcher.
148 160
149=cut 161=cut
150 162
151sub sweep { 163sub sweep {
152 Event::one_event(0); # for now 164 Event::one_event 0; # for now
153} 165}
154 166
155=item $result = loop([$timeout]) 167=item $result = loop([$timeout])
156 168
157This is the version of C<loop> you should use instead of C<Event::loop> 169This is the version of C<loop> you should use instead of C<Event::loop>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines