Do I need Async::Interrupt ?
Zsbán Ambrus
ambrus at math.bme.hu
Sat Mar 10 17:59:43 CET 2012
On 3/10/12, Marc Lehmann <schmorp at schmorp.de> wrote:
> On Fri, Mar 09, 2012 at 09:53:17PM +0100, Zsbán Ambrus <ambrus at math.bme.hu>
> wrote:
> It should always be "safe" to not have Async::Interrupt - if it is
> missing, and would normally be required for safe signal handling, then
> AnyEvent resorts to polling every few seconds, so signals might get
> delayed, but not lost.
>
> That is, unless signal handling is done by the event loop, in which case
> it depends on that one (the ones written in C are typically safe, the ones
> in perl often not). Async::Interrupt is not used in this case, so it is
> obviously safe to not have it :)
Understood. But I'd still like to know specifically about
AnyEvent::Loop. The documentation does not mention whether it handles
signals in a safe or unsafe way. The AnyEvent docs say "you cannot do
race-free signal handling in perl", so I think this means pure-perl
AnyEvent::Loop can not do race-free signal handling without
Async::Interrupt. But now you say "often", so I'm unsure: maybe that
sentence only means you cannot tack race-free signal handling from
pure-perl to an existing event loop that does not handle signals, but
there is some way to have race-free signal handling if you are writing
the loop.
Thus, I'd like you to clarify how signal watchers work with
AnyEvent::Loop, that is, that they use the MAX_SIGNAL_LATENCY wakeup
mechanism to catch signals missed because of a race. It would be nice
if you added a statement to this effect to the documentation as well,
either in the AnyEvent::Loop doc or the AnyEvent doc section about
signal races.
>> Also, is it true that AnyEvent::HTTP never uses signal watchers,
>
> That's true
Thanks for your reply.
Ambrus
More information about the anyevent
mailing list