--- AnyEvent/lib/AnyEvent.pm 2009/11/17 01:19:49 1.296 +++ AnyEvent/lib/AnyEvent.pm 2009/12/13 05:13:15 1.305 @@ -405,6 +405,23 @@ my $w = AnyEvent->signal (signal => "INT", cb => sub { exit 1 }); +=head3 Restart Behaviour + +While restart behaviour is up to the event loop implementation, most will +not restart syscalls (that includes L and AnyEvent's +pure perl implementation). + +=head3 Safe/Unsafe Signals + +Perl signals can be either "safe" (synchronous to opcode handling) or +"unsafe" (asynchronous) - the former might get delayed indefinitely, the +latter might corrupt your memory. + +AnyEvent signal handlers are, in addition, synchronous to the event loop, +i.e. they will not interrupt your running perl program but will only be +called as part of the normal event handling (just like timer, I/O etc. +callbacks, too). + =head3 Signal Races, Delays and Workarounds Many event loops (e.g. Glib, Tk, Qt, IO::Async) do not support attaching @@ -951,13 +968,26 @@ array will be ignored. Best use C when your application allows -it,as it takes care of these details. +it, as it takes care of these details. This variable is mainly useful for modules that can do something useful when AnyEvent is used and thus want to know when it is initialised, but do not need to even load it by default. This array provides the means to hook into AnyEvent passively, without loading it. +Example: To load Coro::AnyEvent whenever Coro and AnyEvent are used +together, you could put this into Coro (this is the actual code used by +Coro to accomplish this): + + if (defined $AnyEvent::MODEL) { + # AnyEvent already initialised, so load Coro::AnyEvent + require Coro::AnyEvent; + } else { + # AnyEvent not yet initialised, so make sure to load Coro::AnyEvent + # as soon as it is + push @AnyEvent::post_detect, sub { require Coro::AnyEvent }; + } + =back =head1 WHAT TO DO IN A MODULE @@ -1116,7 +1146,7 @@ # basically a tuned-down version of common::sense sub common_sense { # from common:.sense 1.0 - ${^WARNING_BITS} = "\xfc\x3f\xf3\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x03"; + ${^WARNING_BITS} = "\xfc\x3f\x33\x00\x0f\xf3\xcf\xc0\xf3\xfc\x33\x00"; # use strict vars subs $^H |= 0x00000600; } @@ -1125,7 +1155,7 @@ use Carp (); -our $VERSION = '5.202'; +our $VERSION = '5.22'; our $MODEL; our $AUTOLOAD; @@ -1133,8 +1163,6 @@ our @REGISTRY; -our $WIN32; - our $VERBOSE; BEGIN { @@ -2435,8 +2463,8 @@ That does not mean that AnyEvent won't take advantage of some additional modules if they are installed. -This section epxlains which additional modules will be used, and how they -affect AnyEvent's operetion. +This section explains which additional modules will be used, and how they +affect AnyEvent's operation. =over 4 @@ -2451,7 +2479,7 @@ If this module is available, then it will be used to implement signal catching, which means that signals will not be delayed, and the event loop -will not be interrupted regularly, which is more efficient (And good for +will not be interrupted regularly, which is more efficient (and good for battery life on laptops). This affects not just the pure-perl event loop, but also other event loops @@ -2511,10 +2539,20 @@ because they rely on inefficient but fork-safe C