3 ms·
> I don’t know how to tell it to only send the signal when the parent process (not thread) dies What about an `atexit` handler and maintaining a table of child
by fc417fc802 2y ago
> I don’t know how to tell it to only send the signal when the parent process (not thread) dies
What about an `atexit` handler and maintaining a table of child processes to kill? If you need something more robust in the face of adverse termination you could instead spawn an independent process, call `wait` on the primary process, and then handle any remaining cleanup.
- badmintonbaseba 2y agoPresumably the author would like something that's handled by the kernel and not user space, so even a SIGKILL-ed parent process would trigger the reaping of the children.
- fc417fc802 2y agoThat would be a pid namespace but was passed over for compatibility reasons I guess. Addressing a SIGKILL'd parent specifically, what about daemonizing the cleanup process but instead of fork use clone with the CLONE_VM flag?