如果没有线程阻塞信号,并且有一个线程处于"sigwait()"中,是否可以保证被阻塞的线程将接收下一
If no threads are blocking a signal, and one thread is in `sigwait()`, is there any guarantee that the blocked thread will receive the next signal?
假设我有一个不阻塞任何信号的多线程应用程序,并且一个线程调用sigwait()
并为SIGTERM
提供掩码。如果进程从外部接收到SIGTERM
,是否保证以下任一项?
- 在
sigwait()
上被阻止的线程将接收它 - 上面的线程是将接收它的唯一线程
我查看了手册页,但它没有解决这两个问题。
至少对于Linux:这两种可能性都不能保证,如:
来自man 7 signal
:
信号处理是每个进程的属性:在多线程应用程序中,特定信号的处理对所有线程都是相同的。
因此,由于多个线程没有阻止SIGINT
,这些线程可能会收到它。
相关文章:
- 从不同线程使用int64的不同字节安全吗
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- 在C++中使用cURL和多线程
- 为什么我的C#代码在调用回C++COM直到Task时会暂停.等待/线程.加入
- 在cuda线程之间共享大量常量数据
- 如何将元素添加到数组的线程安全函数?
- 线程,如果else语句,都是错误的上下文切换后,会发生什么
- C++Boost Asio Pool线程,带有lambda函数和传递引用变量
- Qt C++静态thread_local QNetworkAccessManager是线程应用程序的好选择吗
- 异常属于C++中的线程还是进程
- C++中的线程安全删除
- C++使用params创建线程函数会导致转换错误
- 类与私有变量的其他类之间的线程安全性
- CoInitialize()在单独的线程上崩溃而不返回
- c++中的线程池
- 线程之间的布尔停止信号
- 为什么std::async使用同一个线程运行函数
- 用于矢量处理的多个线程
- C++为线程工作动态地分割例程
- 为什么我不能在 while 循环中创建线程?