In computer operating systems, a process (or task) may wait on another process to complete its execution. … The parent process may then issue a wait system call, which suspends the execution of the parent process while the child executes.
What does wait () do?
The wait() function will suspend execution of the calling thread until status information for one of its terminated child processes is available, or until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process.
How does wait work?
The wait() system call suspends execution of the current process until one of its children terminates. The call wait(&status) is equivalent to: waitpid(-1, &status, 0); The waitpid() system call suspends execution of the current process until a child specified by pid argument has changed state.