Re: Any lightweight way for one thread to force another thread to suspend execution?

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andi Kleen <andi@...>
Cc: <linux-kernel@...>
Date: Monday, June 23, 2008 - 5:08 pm

Andi wrote about my inquire regarding a way to synchronously stop
another thread:

Unfortunately, as Bart pointed out, this stops ALL the threads
in a process (required for POSIX conformance).  However, it appears that
I may be able to do it by creating my threads using clone() with appropriate
parameters rather than pthread_create().

The next question, which I haven't yet been able to answer for myself
from staring at the kernel sources, is whether sending SIGSTOP is
synchronous.  In other words, when the kill() returns, is the target
thread already stopped?  Even on an SMP system where the thread may have
been executing concurrently on another processor?

If not, the next question will be whether there's a more efficient way
to wait for a process to enter the "T" state than busy-polling a file
in /proc.

Thanks,
Eric

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Any lightweight way for one thread to force another thre..., Eric Smith, (Mon Jun 23, 5:08 pm)
Re: Any lightweight way for one thread to force another thre..., Mikael Pettersson, (Tue Jun 24, 3:59 am)