Crate shared_child [] [src]

A library for awaiting and killing child processes from multiple threads.

The std::process::Child type in the standard library provides wait and kill methods that take &mut self, making it impossible to kill a child process while another thread is waiting on it. That design works around a race condition in Unix's waitpid function, where a PID might get reused as soon as the wait returns, so a signal sent around the same time could accidentally get delivered to the wrong process.

However with the newer POSIX waitid function, we can wait on a child without freeing its PID for reuse. That makes it safe to send signals concurrently. Windows has actually always supported this, by preventing PID reuse while there are still open handles to a child process. This library wraps std::process::Child for concurrent use, backed by these APIs.

Structs

SharedChild