当前位置: 技术问答>linux和unix
关于sigwait的一个问题
来源: 互联网 发布时间:2016-04-29
本文导语: apue中说如果一个信号被捕获,而线程正在sigwait调用中等待同一信号,那么操作系统可以让sigwait返回,也可以调用信号处理程序,但不可能出现两者皆可的情况, 我记着sigsuspend是先调用信号处理程序然后在返回是吧...
apue中说如果一个信号被捕获,而线程正在sigwait调用中等待同一信号,那么操作系统可以让sigwait返回,也可以调用信号处理程序,但不可能出现两者皆可的情况,
我记着sigsuspend是先调用信号处理程序然后在返回是吧,就是说sigwait只能有一样发生,要么调用信号处理程序但是sigwait就不可能返回,要么sigwait返回就不调用信号处理程序。是这个意思吗?
我记着sigsuspend是先调用信号处理程序然后在返回是吧,就是说sigwait只能有一样发生,要么调用信号处理程序但是sigwait就不可能返回,要么sigwait返回就不调用信号处理程序。是这个意思吗?
|
还是看原话比较容易理解:
也说了这是实现相关的,你不妨写个程序试试你的平台是如何实现的.
If multiple threads are blocked in calls to sigwait for the same signal, only one of the threads will return from sigwait when the signal is delivered. If a signal is being caught (the process has established a signal handler by using sigaction, for example) and a thread is waiting for the same signal in a call to sigwait, it is left up to the implementation to decide which way to deliver the signal. In this case, the implementation could either allow sigwait to return or invoke the signal handler, but not both.
也说了这是实现相关的,你不妨写个程序试试你的平台是如何实现的.
If multiple threads are blocked in calls to sigwait for the same signal, only one of the threads will return from sigwait when the signal is delivered. If a signal is being caught (the process has established a signal handler by using sigaction, for example) and a thread is waiting for the same signal in a call to sigwait, it is left up to the implementation to decide which way to deliver the signal. In this case, the implementation could either allow sigwait to return or invoke the signal handler, but not both.