AnyEvent and piped open
Marc Lehmann
schmorp at schmorp.de
Sun Jul 17 09:12:48 CEST 2011
On Fri, Jul 15, 2011 at 09:25:14PM -0400, Laurent <laurent.aml at gmail.com> wrote:
> > So, again, this really isn't a limitation (not even a "limitation") in EV,
> > but a logical consequence of using events. Note that traditional use of
> > popen/pclose works just fine even when EV reaps children.
>
> That's because you consider that an event loop should not do pooling,
> but it can.
> In this particular case, pooling could even happen on SIGCHLD events,
> to make it more event-friendly.
Polling, not pooling. I don't know what you mean with pooling, but it
simply can't be done without making the event loop poll for every single
process, which would only be needed to support buggy programs like your
example, which can trivially be rewritten.
So, no, there is no other way to implement this *in an event-based way*,
which is the whole point of an event loop.
Whatever you want to be implemented, it would just work around a design
bug in your program.
> I think it was worth making a point that all this is not that obvious.
It might not be obvious if you don't know how posix and unix work, but
thats what documentation is for.
Besides, I think you are just trolling a bit here - somebody who really
has no clue how process reaping works will not expect to be able to set a
child watcher after the process has already exited and/or reaped.
The fact that you selectively quote the wrong parts of the AnyEvent child
watcher documentation doesn't really help it either. The documentation
clearly refers you to event-loop specific behaviour if you want any
extensions to the normal behaviour.
--
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