Re: PATCH: documentation improvements
[email protected] (Joshua N Pritikin) Mon, 29 Nov 2004 16:27:23 +0530
| Newsgroups | perl.loop |
|---|---|
| Message-ID | <[email protected]> |
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
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQBBqwCTqcqnlKSmC70RAu6tAKCkXLt+dsk15soSfyP/aDt0pmkMjQCgy5Ei lbPLzk4bAinYOXwzh7EUocY= =Jk/O -----END PGP SIGNATURE-----