c - waitid会消耗SIGCHLD吗?

标签 c signals posix

waitid/waitpid 是否会消耗任何待处理的 SIGCHLD

例如,如果一个线程调用 waitid,而另一个线程调用 sigwaitinfo 或从 signalfd 读取,我是否可以假设这两个调用都返回正确的数据子进程何时终止?

最佳答案

找到https://lkml.org/lkml/2009/1/10/181 :

That notification only tells us that at least one process has died; SIGCHLD may only be pending once at a time. If further children die before we clear the signal, nothing will happen. ... Because it only tells us that at least one process has died, we have to call waitpid() repeatedly until we have exhausted the wait queue.

~~Calling waitpid() does not clear the pending signal.~~

Manpages 没有提到“等待队列”,但它解释了一些事情。

关于c - waitid会消耗SIGCHLD吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24092141/

相关文章:

c - 为什么 POSIX mmap 不返回 volatile void*?

c++ - std::condition_variable::wait()是POSIX线程取消点吗?

c++ - 等待命令不会等待子进程完成 c cpp c++

c - 微型 c 编译器使用 GetUserName

c - 移动钻石的下半部分

c++ - 使用 Auto 和 Lambda 处理信号?

python - librosa.load返回什么信息?

c - 在 C 中安装信号处理程序

c - 如何给出附加到 shmat() 共享内存段中的起始地址?

C数据段标识