Eric Smith writes: > Andi wrote about my inquire regarding a way to synchronously stop > another thread: > > Any such mechanism will need a syscall, and it's unlikely that > > any syscall will get much cheaper than a kill(SIGSTOP) > > 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. SIGSTOP is unreliable since some other process may wake the target up with a SIGCONT. man ptrace(), see the PTRACE_ATTACH request. (Presumably it will DTRT if you give it a tid not just a pid, but I haven't tested that.) --
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| Andi Kleen | [PATCH x86] [0/16] Various i386/x86-64 changes |
| Vladislav Bolkhovitin | Re: Integration of SCST in the mainstream Linux kernel |
| Tarkan Erimer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
git: | |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Natalie Protasevich | [BUG] New Kernel Bugs |
| Arjan van de Ven | Re: [GIT]: Networking |
