- Mastering Linux Kernel Development
- Raghu Bharadwaj
- 127字
- 2021-07-08 09:47:20
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.
推薦閱讀
- Learning Chef
- Python for Secret Agents:Volume II
- MySQL數據庫應用與管理 第2版
- Windows系統管理與服務配置
- MongoDB for Java Developers
- SQL for Data Analytics
- Mastering LibGDX Game Development
- Visual C++應用開發
- Learning Node.js for .NET Developers
- 編程可以很簡單
- Android Development Tools for Eclipse
- 深入實踐DDD:以DSL驅動復雜軟件開發
- Ext JS 4 Plugin and Extension Development
- 超好玩的Scratch 3.5少兒編程
- Learning NHibernate 4