Name: Cfag 2011-12-07 19:58
ok
I have a program creating several process by forking (don't care about what they do). This number of process must stay the same so the first one after creating em all (the prob could also appear here but whatever) just wait.
So when a child finish finish, the first one receive the signal, do several crap and fork again. But if an other process finish before the first one get back to waiting state, it won't be replaced.
Anyone have a solution for that or is there a c function to get the number of child process ?
I though about keeping childs' pid and check em before return in waiting state but that seems too dirty. (and a child could finish right after it is checked and before end of the check).
I have a program creating several process by forking (don't care about what they do). This number of process must stay the same so the first one after creating em all (the prob could also appear here but whatever) just wait.
So when a child finish finish, the first one receive the signal, do several crap and fork again. But if an other process finish before the first one get back to waiting state, it won't be replaced.
Anyone have a solution for that or is there a c function to get the number of child process ?
I though about keeping childs' pid and check em before return in waiting state but that seems too dirty. (and a child could finish right after it is checked and before end of the check).