Provide a way to set parent process behavior
The default parent process behavior is good enough in most cases :-)
But sometimes I want parent process do more jobs, something like the following:
- keep child process alive
- monitor memory usage in child processes
- when it receives some signals, propogate thses signal to child processes ...
Then I think it'd be awesome to have a way to specify parent process behavior. I've come up with two solutions:
- Add a method like
with_parent
toPrefork
struct, it takesHashSet<Pid>
as input argument. It provides most flexibility to user to define the behavior, but it's up to user side to ensure right behaivor(like avoid zombie child processes) - Provides some builder like
keep_alive
,propogate_signals
,max_child_memory
, and so on.. I think it's more friendly to users, but we need to maintain more ofPrefork
struct.
What do you think?