On Mon, 2004-11-29 at 09:51 +0000, Zefram wrote:
> #!/usr/bin/perl
> use warnings;
> use strict;
> use Event;
> my $w;
> $w = Event->signal(signal => "USR1", cb => sub {
>       print "handler got hits=", $_[0]->hits, "\n";
>       kill "USR1" => 0;
>       $w->stop;
>       $w->start;
> });
> kill "USR1" => 0;
> Event::loop;
> 
> In Event version 0.87 the handler is invoked repeatedly: each signal
> sent by the handler remains in the counts while the watcher is stopped
> and restarted, and triggers another event next time round the loop.
> Event version 1.00 clears the signal count when the watcher is stopped,
> and so discards the received signal, producing the intended output.
> If "Event::_queue_pending();" is added immediately before "$w->start;",
> the behaviour is as intended in either version.

Well, OK, how about this?

Note: There is no implicit check for unreified asynchronous events.
There is an obscure situation where this can make a difference.  If
you are starting additional signal watchers for the same signal then
such watchers may see signals which were actually received prior to
being started.  Call C<queue_pending()> immediately before starting a
signal watcher if you need to avoid this.

-- 
A new cognitive theory of emotion, http://openheartlogic.org

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to