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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.45 by root, Mon Apr 7 19:42:36 2008 UTC vs.
Revision 1.48 by root, Mon Apr 14 19:00:23 2008 UTC

59to follow. AnyEvent, on the other hand, is lean and to the point by only 59to follow. AnyEvent, on the other hand, is lean and to the point by only
60offering the functionality that is useful, in as thin as a wrapper as 60offering the functionality that is useful, in as thin as a wrapper as
61technically possible. 61technically possible.
62 62
63Of course, if you want lots of policy (this can arguably be somewhat 63Of course, if you want lots of policy (this can arguably be somewhat
64useful) and you want to force your users to the one and only event model 64useful) and you want to force your users to use the one and only event
65your module forces on them, you should I<not> use this module. 65model, you should I<not> use this module.
66 66
67 67
68=head1 DESCRIPTION 68=head1 DESCRIPTION
69 69
70L<AnyEvent> provides an identical interface to multiple event loops. This 70L<AnyEvent> provides an identical interface to multiple event loops. This
179=item $cv->wait 179=item $cv->wait
180 180
181Wait (blocking if necessary) until the C<< ->broadcast >> method has been 181Wait (blocking if necessary) until the C<< ->broadcast >> method has been
182called on c<$cv>, while servicing other watchers normally. 182called on c<$cv>, while servicing other watchers normally.
183 183
184Not all event models support a blocking wait - some die in that case, so
185if you are using this from a module, never require a blocking wait, but
186let the caller decide wether the call will block or not (for example,
187by coupling condition variables with some kind of request results and
188supporting callbacks so the caller knows that getting the result will not
189block, while still suppporting blockign waits if the caller so desires).
190
191You can only wait once on a condition - additional calls will return 184You can only wait once on a condition - additional calls will return
192immediately. 185immediately.
186
187Not all event models support a blocking wait - some die in that case
188(programs might want to do that so they stay interactive), so I<if you
189are using this from a module, never require a blocking wait>, but let the
190caller decide wether the call will block or not (for example, by coupling
191condition variables with some kind of request results and supporting
192callbacks so the caller knows that getting the result will not block,
193while still suppporting blocking waits if the caller so desires).
194
195Another reason I<never> to C<< ->wait >> in a module is that you cannot
196sensibly have two C<< ->wait >>'s in parallel, as that would require
197multiple interpreters or coroutines/threads, none of which C<AnyEvent>
198can supply (the coroutine-aware backends C<Coro::EV> and C<Coro::Event>
199explicitly support concurrent C<< ->wait >>'s from different coroutines,
200however).
193 201
194=item $cv->broadcast 202=item $cv->broadcast
195 203
196Flag the condition as ready - a running C<< ->wait >> and all further 204Flag the condition as ready - a running C<< ->wait >> and all further
197calls to C<wait> will return after this method has been called. If nobody 205calls to C<wait> will return after this method has been called. If nobody
252 260
253 AnyEvent::Impl::CoroEV based on Coro::EV, best choice. 261 AnyEvent::Impl::CoroEV based on Coro::EV, best choice.
254 AnyEvent::Impl::EV based on EV (an interface to libev, also best choice). 262 AnyEvent::Impl::EV based on EV (an interface to libev, also best choice).
255 AnyEvent::Impl::CoroEvent based on Coro::Event, second best choice. 263 AnyEvent::Impl::CoroEvent based on Coro::Event, second best choice.
256 AnyEvent::Impl::Event based on Event, also second best choice :) 264 AnyEvent::Impl::Event based on Event, also second best choice :)
257 AnyEvent::Impl::Glib based on Glib, second-best choice. 265 AnyEvent::Impl::Glib based on Glib, third-best choice.
258 AnyEvent::Impl::Tk based on Tk, very bad choice. 266 AnyEvent::Impl::Tk based on Tk, very bad choice.
259 AnyEvent::Impl::Perl pure-perl implementation, inefficient. 267 AnyEvent::Impl::Perl pure-perl implementation, inefficient but portable.
260 268
261=item AnyEvent::detect 269=item AnyEvent::detect
262 270
263Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model if 271Returns C<$AnyEvent::MODEL>, forcing autodetection of the event model if
264necessary. You should only call this function right before you would have 272necessary. You should only call this function right before you would have

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines