Results 1 to 6 of 6
hello,
im doing a program where a process creates 5 processes,
i need that the father process dont finishes till all the five processes finish.
how to do it?????????????
i ...
- 03-16-2008 #1Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
[SOLVED] c programmation ( wait() )
hello,
im doing a program where a process creates 5 processes,
i need that the father process dont finishes till all the five processes finish.
how to do it?????????????
i found the function wait(); but it doen't work because it is only for one of the processes.
thanks to help me
- 03-16-2008 #2
wait
try waitpid()
- 03-16-2008 #3Linux Newbie
- Join Date
- Mar 2008
- Location
- Hyderabad
- Posts
- 109
you get the pid of child process when you call fork. collect all pids and call waitpid for each process.
- 03-16-2008 #4Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
thanks but i need a function to wait for all process , in my case yes i have just 5 processes , but imagine for a big number of processes
- 03-16-2008 #5Linux Newbie
- Join Date
- Mar 2008
- Location
- Hyderabad
- Posts
- 109
I don't know how memory intensive application you r going to make.
But can give dynamic memory allocation for an array of pid a chance.
something like
i=0;
while(pid[i])
{
waitpid(pid[i]);
i++;
}
- 03-20-2008 #6Just Joined!
- Join Date
- Dec 2007
- Location
- Algeria
- Posts
- 26
thanks
thanks .


