- 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.
推薦閱讀
- Mastering JavaScript Functional Programming
- 數(shù)字媒體應用教程
- Intel Galileo Essentials
- Node.js 10實戰(zhàn)
- C語言程序設(shè)計教程(第2版)
- Object-Oriented JavaScript(Second Edition)
- 高級C/C++編譯技術(shù)(典藏版)
- 用Flutter極速構(gòu)建原生應用
- PLC編程與調(diào)試技術(shù)(松下系列)
- Java EE 7 Performance Tuning and Optimization
- Express Web Application Development
- Spring核心技術(shù)和案例實戰(zhàn)
- Learning Nessus for Penetration Testing
- 現(xiàn)代CPU性能分析與優(yōu)化
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite