Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

come back here son

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).

Name: Anonymous 2011-12-07 20:18

Just keep your own counter/state information

Name: Anonymous 2011-12-07 20:39

a handler for the signal which would update the counter when he is doing his craps ?

Name: cheap wedding dresses 2011-12-07 21:12

I will bookmark your blog and have my kids check up here frequently <a href="http://www.theuniuni.com/weddings-events/wedding-dresses.html" title="cheap wedding dresses">cheap wedding dresses</a>. I’m very certain they will understand lots of new stuff <a href="http://www.theuniuni.com/shoes-boots/heels-pumps.html" title="High Heel Pumps">High Heel Pumps</a> here than anybody else. I do appreciate that youve added relevant and intelligent commentary here though. Thank you!

Name: F r o z e n V o i d !!mJCwdV5J0Xy2A21 2011-12-08 4:34

You don't event have to query anything.
Maintain a counter:int NumOfRunningThreads
each new threads adds +1 at start, at exit substract -1
you get exact number of threads this way.

Name: Anonymous 2011-12-08 4:38

I have an anus that has to fork a number of other anus called anii. Please help me with this problem.

Name: Anonymous 2011-12-08 4:53

you need barriers/lock/sync, any child finishing must wait until first process is ready to fork again

Don't change these.
Name: Email:
Entire Thread Thread List