pub fn signal_same_process(
pid: u32,
expected: &ProcessIdentity,
signal: StopSignal,
) -> boolExpand description
Deliver signal to pid only while it is still the process expected
describes. True when the signal was delivered.
The check and the signal are bound to one process object wherever the OS allows it, so a PID recycled in between is never hit:
- Windows: one handle opened with query and terminate rights; the
identity is read through that handle and
TerminateProcessuses it. - Linux: a pidfd is opened first, the identity checked, then
pidfd_send_signaltargets the pidfd (kernel ≥ 5.3; older kernels fall back to the re-check +killbelow). - macOS and other Unix: the identity is re-checked immediately before
kill; the remaining window is microseconds.