Skip to main content

Module registry

Module registry 

Source
Expand description

Process-wide registry of live spawned-child PIDs.

Keyed by a monotonic AtomicU64 counter rather than Child::id() because POSIX recycles PIDs aggressively on long-running runners; a recycled PID would collide with a previously-deregistered entry.

Stores PIDs (not Child handles): the ScopedChild wrapper owns the Child outright so it can call wait_with_output / wait normally, and the signal handler kills by PID via a kill -9 <pid> shell subprocess on Unix (avoids adding libc as a workspace dep) or OpenProcess + TerminateProcess on Windows. No ownership transfer, no race between wait and kill.