Crate waitpid_any
source ·Expand description
waitpid(2)
but for arbitrary non-child processes.
waitpid(2)
can only
be used to wait for direct child processes, or it fails immediately.
This crate provides a extension to wait for the exit of any process, not necessarily child processes. Due to platform limitations, the exit reason and status codes still cannot be retrieved.
Implementation details
- On Linux,
pidfd_open(2)
andpoll(2)
are used. Thus only Linux 5.3 or later is supported. - On Windows,
OpenProcess
andWaitForSingleObject
are used. - On *BSD, including macOS,
kqueue(2)
is used. - Other platforms are not supported currently.
Structs
- A locked handle to a process.