What arguments should i pass to wait() so that it waits for all child processes to terminate before continuing
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
waitonly waits for a single child. You should callwait(NULL)in a loop until it returns-1witherrno == ECHILD:From the wait(2) manual page:
As such, you must check for ECHILD, lest you be fooled by a caught signal.