Skip to main content

wait_child_or

Function wait_child_or 

Source
pub fn wait_child_or(
    child: &mut Child,
    wake: Option<BorrowedFd<'_>>,
    deadline: Option<Instant>,
) -> Result<Wakeup>
Expand description

Wait until child exits, wake becomes readable, or deadline passes, without polling. With neither a wake descriptor nor a deadline this blocks until the child exits; a deadline already in the past only probes.

Linux: one poll(2) on a pidfd of child (pinned to this unreaped child, so it cannot name a recycled pid) and wake. Elsewhere, or without pidfd_open, a short try_wait loop keeps the same contract.

ยงErrors

Returns the error of inspecting or reaping the child, or of poll(2).