AnyEvent and piped open

Marc Lehmann schmorp at schmorp.de
Fri Jul 15 23:20:12 CEST 2011


On Fri, Jul 15, 2011 at 01:51:05PM -0400, Laurent <laurent.aml at gmail.com> wrote:
> So wait/waitpid (and wrappers such as close() for piped open) should
> not be relied upon with EV.

Neither wait nor waitpid changes function, actually.

> AnyEvent doc is less clear on the subject. It suggests that some
> implementations support to set the child handler after the child
> exists, but don't mention the EV restriction (no event loop between
> process creation and child event initialization).

There is no restriction, this is just common sense - you cannot expect to
set a child watcher on a nonexistant process.

> For example, I have not seen anything about it for the pure Perl
> implementation (possibly because there is no such limitation for it?).

If, with "limitation" you mean that the process still has to exist, then all
event loops have this limitation.

This is not, of course, a limitation - as soon as the process no longer
exists, it simply makes no sense to add a child watcher for it, because the
very pid that identifies the process could have been reused.

-- 
                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 mailing list