--- AnyEvent/lib/AnyEvent.pm 2009/03/25 17:33:11 1.195 +++ AnyEvent/lib/AnyEvent.pm 2009/03/26 20:17:44 1.198 @@ -139,6 +139,12 @@ callback when the event occurs (of course, only when the event model is in control). +Note that B +potentially in use by the event loop (such as C<$_> or C<$[>) and that B<< +callbacks must not C >>. The former is good programming practise in +Perl and the latter stems from the fact that exception handling differs +widely between event loops. + To disable the watcher you have to destroy it (e.g. by setting the variable you store it in to C or otherwise deleting all references to it). @@ -1046,8 +1052,9 @@ our ($SIGPIPE_R, $SIGPIPE_W, %SIG_CB, %SIG_EV, $SIG_IO); sub _signal_exec { + sysread $SIGPIPE_R, my $dummy, 4; + while (%SIG_EV) { - sysread $SIGPIPE_R, my $dummy, 4; for (keys %SIG_EV) { delete $SIG_EV{$_}; $_->() for values %{ $SIG_CB{$_} || {} }; @@ -1856,7 +1863,7 @@ Perl 5.8 has numerous memleaks that sometimes hit this module and are hard to work around. If you suffer from memleaks, first upgrade to Perl 5.10 and check wether the leaks still show up. (Perl 5.10.0 has other annoying -mamleaks, such as leaking on C and C but it is usually not as +memleaks, such as leaking on C and C but it is usually not as pronounced).