in reply to A suicidal parent OR death of a forking server
1) Don't have the child die. Simply have it return instead.
2)a) Keep a count and refuse any more connections.
b) Have exactly 5 children at all times, that don't return but merely go idle when their client disconnects. Have the parent check for any available idle children when a new connection comes in, and assign the connection to one of them. Refuse if no children are idle.
3)a) Use a semaphore.
b) Push onto a thread safe array of commands to do from the children, and shift off the action to do next in a work thread.
c) Token passing between the children.
d) Etc.
|
|---|