Signal delivery & Threads

I have a multiple threaded process, I sent SIGSTOP to the process and
expected to see all the threads to be stopped, but I only saw one of them
actually stopped, the rest ones were intact, please see below. Why did this
signal only impact one of the threads, and how did the kernel knwo which
thread it should pick?

Thanks,

Xuedong

Before sending SIGSTOP:

4149317 1 rotocolSerialMiser 11r RECEIVE 7
4149318 1 ProtocolSerialWAP7 11r RECEIVE 5
4149318 2 ProtocolSerialWAP7 9r NANOSLEEP
4149318 3 ProtocolSerialWAP7 10r NANOSLEEP
4149319 1 ndAloneProgressive 11r RECEIVE 4

After sending SIGSTOP:
4149317 1 rotocolSerialMiser 11r RECEIVE 7
4149318 1 ProtocolSerialWAP7 11r RECEIVE 5
4149318 2 ProtocolSerialWAP7 9r NANOSLEEP
4149318 3 ProtocolSerialWAP7 10r STOPPED
4149319 1 ndAloneProgressive 11r RECEIVE 4

Xuedong Chen <Xuedong.Chen@igt.com> wrote:

I have a multiple threaded process, I sent SIGSTOP to the process and
expected to see all the threads to be stopped, but I only saw one of them
actually stopped, the rest ones were intact, please see below. Why did this
signal only impact one of the threads, and how did the kernel knwo which
thread it should pick?

If a thread is told to stop when it’s already in a blocked state (as the
other threads are), the kernel just sets a pending stop indication on the
thread. When a thread eventually switches to the READY or RUNNING state,
the kernel will take note that it has a pending stop on it and puts
it in the STOPPED state instead.


Brian Stecher (bstecher@qnx.com) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M 1W8

That makes sense, Thanks.

Xuedong
<bstecher@qnx.com> wrote in message news:bfrv00$mdh$1@nntp.qnx.com

Xuedong Chen <> Xuedong.Chen@igt.com> > wrote:
I have a multiple threaded process, I sent SIGSTOP to the process and
expected to see all the threads to be stopped, but I only saw one of
them
actually stopped, the rest ones were intact, please see below. Why did
this
signal only impact one of the threads, and how did the kernel knwo which
thread it should pick?

If a thread is told to stop when it’s already in a blocked state (as the
other threads are), the kernel just sets a pending stop indication on the
thread. When a thread eventually switches to the READY or RUNNING state,
the kernel will take note that it has a pending stop on it and puts
it in the STOPPED state instead.


Brian Stecher (> bstecher@qnx.com> ) QNX Software Systems, Ltd.
phone: +1 (613) 591-0931 (voice) 175 Terence Matthews Cr.
+1 (613) 591-3579 (fax) Kanata, Ontario, Canada K2M
1W8