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.23 by root, Wed Mar 7 17:37:24 2007 UTC vs.
Revision 1.30 by root, Fri Nov 2 19:12:02 2007 UTC

195C<AnyEvent::Impl:xxx> modules, but can be any other class in the case 195C<AnyEvent::Impl:xxx> modules, but can be any other class in the case
196AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>). 196AnyEvent has been extended at runtime (e.g. in I<rxvt-unicode>).
197 197
198The known classes so far are: 198The known classes so far are:
199 199
200 EV::AnyEvent based on EV (an interface to libev, best choice)
200 AnyEvent::Impl::Coro based on Coro::Event, best choise. 201 AnyEvent::Impl::Coro based on Coro::Event, second best choice.
201 AnyEvent::Impl::Event based on Event, also best choice :) 202 AnyEvent::Impl::Event based on Event, also second best choice :)
202 AnyEvent::Impl::Glib based on Glib, second-best choice. 203 AnyEvent::Impl::Glib based on Glib, second-best choice.
203 AnyEvent::Impl::Tk based on Tk, very bad choice. 204 AnyEvent::Impl::Tk based on Tk, very bad choice.
204 AnyEvent::Impl::Perl pure-perl implementation, inefficient. 205 AnyEvent::Impl::Perl pure-perl implementation, inefficient.
205 206
206=item AnyEvent::detect 207=item AnyEvent::detect
245 246
246package AnyEvent; 247package AnyEvent;
247 248
248no warnings; 249no warnings;
249use strict; 250use strict;
251
250use Carp; 252use Carp;
251 253
252our $VERSION = '2.52'; 254our $VERSION = '2.55';
253our $MODEL; 255our $MODEL;
254 256
255our $AUTOLOAD; 257our $AUTOLOAD;
256our @ISA; 258our @ISA;
257 259
259 261
260our @REGISTRY; 262our @REGISTRY;
261 263
262my @models = ( 264my @models = (
263 [Coro::Event:: => AnyEvent::Impl::Coro::], 265 [Coro::Event:: => AnyEvent::Impl::Coro::],
266 [EV:: => EV::AnyEvent::],
264 [Event:: => AnyEvent::Impl::Event::], 267 [Event:: => AnyEvent::Impl::Event::],
265 [Glib:: => AnyEvent::Impl::Glib::], 268 [Glib:: => AnyEvent::Impl::Glib::],
266 [Tk:: => AnyEvent::Impl::Tk::], 269 [Tk:: => AnyEvent::Impl::Tk::],
267 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::], 270 [AnyEvent::Impl::Perl:: => AnyEvent::Impl::Perl::],
268); 271);
346 my (undef, %arg) = @_; 349 my (undef, %arg) = @_;
347 350
348 my $signal = uc $arg{signal} 351 my $signal = uc $arg{signal}
349 or Carp::croak "required option 'signal' is missing"; 352 or Carp::croak "required option 'signal' is missing";
350 353
351 $SIG_CB{$signal}{$arg{cb}} = $arg{cb}; 354 $SIG_CB{$signal}{$arg{cb} += 0} = $arg{cb};
352 $SIG{$signal} ||= sub { 355 $SIG{$signal} ||= sub {
353 $_->() for values %{ $SIG_CB{$signal} || {} }; 356 $_->() for values %{ $SIG_CB{$signal} || {} };
354 }; 357 };
355 358
356 bless [$signal, $arg{cb}], "AnyEvent::Base::Signal" 359 bless [$signal, $arg{cb}], "AnyEvent::Base::Signal"
371our $PID_IDLE; 374our $PID_IDLE;
372our $WNOHANG; 375our $WNOHANG;
373 376
374sub _child_wait { 377sub _child_wait {
375 while (0 < (my $pid = waitpid -1, $WNOHANG)) { 378 while (0 < (my $pid = waitpid -1, $WNOHANG)) {
376 $_->() for values %{ (delete $PID_CB{$pid}) || {} }; 379 $_->() for values %{ $PID_CB{$pid} || {} }, %{ $PID_CB{0} || {} };
377 } 380 }
378 381
379 undef $PID_IDLE; 382 undef $PID_IDLE;
380} 383}
381 384
439I<rxvt-unicode> distribution. 442I<rxvt-unicode> distribution.
440 443
441I<rxvt-unicode> also cheats a bit by not providing blocking access to 444I<rxvt-unicode> also cheats a bit by not providing blocking access to
442condition variables: code blocking while waiting for a condition will 445condition variables: code blocking while waiting for a condition will
443C<die>. This still works with most modules/usages, and blocking calls must 446C<die>. This still works with most modules/usages, and blocking calls must
444not be in an interactive appliation, so it makes sense. 447not be in an interactive application, so it makes sense.
445 448
446=head1 ENVIRONMENT VARIABLES 449=head1 ENVIRONMENT VARIABLES
447 450
448The following environment variables are used by this module: 451The following environment variables are used by this module:
449 452

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines