官术网_书友最值得收藏!

wait

For processes and threads created by a parent, it might be functionally useful for the parent to know the execution status of the child process/thread. This can be achieved using the wait family of system calls:

#include <sys/types.h>
#include <sys/wait.h>
pid_t wait(int *status);
pid_t waitpid(pid_t pid, int *status, intoptions);
int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options)

These system calls update the calling process with the state change events of a child. The following state change events are notified:

  • Termination of child
  • Stopped by a signal
  • Resumed by a signal

In addition to reporting the status, these APIs allow the parent process to reap a terminated child. A process on termination is put into zombie state until the immediate parent engages the wait call to reap it.

主站蜘蛛池模板: 海阳市| 阜城县| 聂拉木县| 肥城市| 河曲县| 博客| 云和县| 辛集市| 菏泽市| 正宁县| 湘潭市| 大埔区| 横峰县| 滦平县| 威海市| 龙川县| 吴忠市| 闻喜县| 桐乡市| 高州市| 甘谷县| 本溪市| 铅山县| 广宁县| 丰顺县| 栖霞市| 桓台县| 古交市| 伊金霍洛旗| 丰宁| 隆化县| 麻阳| 手游| 阿鲁科尔沁旗| 赣榆县| 革吉县| 许昌县| 舒兰市| 祥云县| 临沂市| 刚察县|