NAME
wait, waitpid, waitid - wait for process to change state
SYNOPSIS
#include
#include
pid_t wait(int *status);
pid_t waitpid(pid_t pid, int *status, int options);
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
waitid():
_SVID_SOURCE || _XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
If no wait() function is used, the parent vs child process is in a race condition, i.e. the order of execution of the two processes is not determined.
When there are different exit paths in the child, it is possible to have them identified by the status variable, calling WEXITSTATUS(status) in the parent process after wait(2), according to _exit(status) numbers.
/*********************END*********************/
No comments:
Post a Comment