wait3.2 (2010 09)
w
wait3(2) wait3(2)
APPLICATION USAGE
Threads Considerations
In a multi-threaded application, only the calling thread is suspended by
wait3()
and wait4().
The
wait3() and wait4() functions will not return until all threads in the process have reached the
desired state. For example, wait3() and
wait4() will not return until all threads have terminated.
If the
WUNTRACED or WCONTINUED options are specified,
wait3() and wait4() will not return until
all threads have stopped or continued respectively.
RETURN VALUE
If
wait3(), wait4(),orwaitpid()
returns because the status of a child process is available, the
return value is the process ID of that child process. If wait3(), wait4(),orwaitpid() returns due
to the receipt of a signal, the return value receives a
-1 and errno is set to [EINTR].
If
wait3() or wait4() was called with the
WNOHANG options argument where status is not available
for any process specified by the pid argument,
0 will be returned.
Otherwise, (pid_t)
-1 will be returned and
errno will be set to indicate the error.
ERRORS
If
wait3() or wait4() fails, errno is set to one of the following values:
[ECHILD] The calling process has no existing unwaited-for child processes; or the states
specified by the options argument are invalid for the set of processes specified by
the pid argument.
[EFAULT] Problems were encountered in the retrieval of status information for the specified
child process.
[EINTR] The wait3() or wait4() function has been interrupted by a signal. The value in
the location pointed to by the stat_loc argument is undefined.
[EINVAL] The options argument to
wait3(), wait4(),or
waitpid() is invalid.
WARNINGS
The behavior of
wait3() and wait4() is affected if the SIGCLD signal is set to
SIG_IGN. See the
WARNINGS section of signal(5). Signal handlers that cause system calls to be restarted can affect the
[EINTR] condition described above (see bsdproc (3C) and sigaction (2)).
AUTHOR
The
wait3() and wait4() functions were developed by HP, AT&T, and the University of California,
Berkeley.
SEE ALSO
exec(2), exit(2), fork(2), pause(2), wait(2), waitpid(2).
2 Hewlett-Packard Company − 2 − HP-UX 11i Version 3: September 2010