Do I need Async::Interrupt ?
schmorp at schmorp.de
Sat Mar 10 10:32:14 CET 2012
On Fri, Mar 09, 2012 at 09:53:17PM +0100, Zsbán Ambrus <ambrus at math.bme.hu> wrote:
> If I have an AnyEvent program that never uses signal watchers, then is
> it safe to use it with the AnyEvent::Loop backend but without
> installing the Async::Interrupt module? I want to determine
> dependencies for when I distribute this program.
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 :)
Keep in mind that sigchld is also a signal, so if you use run_cmd or
something like it you also rely on signals.
> Also, is it true that AnyEvent::HTTP never uses signal watchers, not
> even indidectly (eg. through AE::DNS or AE::Socket etc)?
That's true - the only signal "thing" these modules "rely" on is that they
might cause SIGPIPE signals, which are normally ignored by AnyEvent.
The advantage of Async::Interrupt being available and in use is lower
memory consumption and the avoidance of races and reduced cpu time.
On very low power devices, the extra wakeups can be a real power drain. On
a desktop system it's probably hard to even detect - the occasional signal
delays would then be more of an issue.
The choice of a Deliantra, the free code+content MORPG
-----==- _GNU_ http://www.deliantra.net
----==-- _ generation
---==---(_)__ __ ____ __ Marc Lehmann
--==---/ / _ \/ // /\ \/ / schmorp at schmorp.de
More information about the anyevent