Le Mercredi 30 mars 2005 à 14:17 -0400, zean zean a écrit : > Hi Hackers: > > Excuse for my badly English. which is the best form to wait the > finish of execution of a child.
It depends on the context of your program (synchronous/asynchronous). > My idea is: > > pid_t chilpid; > > while(childpid != wait(&status)) > ; That's a possibility, you can catch SIGCHLD with a signal handler (see signal(3), sigprocmask(2), sigaction(2)) which would set a global flag, and then use a non-blocking waitpid(2) or wait4(2) instead. Note: What you suggested isn't really safe. You shouldn't ignore wait(2) return status (could be -1 because something unexpected happened, see ERRORS section from the manpage). -- Florent Thoumie [EMAIL PROTECTED]
signature.asc
Description: This is a digitally signed message part