In unix, If a multi-threaded process was sent a signal, which thread will be the one to execute the handling function?
if it is a multi-cpu machine, more than 1 thread is running at the same time. which thread will be the on to run the signal handling function?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
According to man 7 signal, all threads in the process share the same signal handler, and if a signal is delivered to a process with multiple threads that have not blocked the signal, one of them is arbitrarily chosen to receive it.
Having a multi-CPU machine will not change these semantics.