vibe.d - asynchronously wait() for process to exit

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Jun 20 09:16:32 PDT 2016


On 6/17/16 9:53 AM, Vladimir Panteleev wrote:
> std.process.wait() will wait for a child process to exit and return its
> exit code. How can this be done in Vibe.d, without blocking other fibers
> and without creating a new thread?

What is the OS support for waitid 
(http://man7.org/linux/man-pages/man2/waitpid.2.html)? Seems to have 
support for async waiting of multiple processes (at least it can return 
immediately if no child has exited). One consideration is how responsive 
you need to be to a process exiting -- is it ok for example to be 
notified 500ms after the process exits? If so, you can interleave timed 
waits for socket data with a check to see if any process exits. I've 
done this in the past for such things. I don't know how well this works 
for libevent though.

-Steve


More information about the Digitalmars-d-learn mailing list