- 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.
推薦閱讀
- C程序設計簡明教程(第二版)
- Java高手真經(高級編程卷):Java Web高級開發技術
- 我的第一本算法書
- Python高級機器學習
- Python高效開發實戰:Django、Tornado、Flask、Twisted(第2版)
- Symfony2 Essentials
- Protocol-Oriented Programming with Swift
- Mastering Xamarin.Forms(Second Edition)
- jQuery炫酷應用實例集錦
- Mockito Essentials
- Oracle實用教程
- OpenCV Android Programming By Example
- Getting Started with Electronic Projects
- Apache Solr for Indexing Data
- Manage Your SAP Projects with SAP Activate