All of lore.kernel.org
 help / color / mirror / Atom feed
* Any lightweight way for one thread to force another thread to  suspend execution?
@ 2008-06-20 23:54 Eric Smith
  2008-06-21 14:04 ` Andi Kleen
  2008-06-21 16:38 ` Bart Van Assche
  0 siblings, 2 replies; 9+ messages in thread
From: Eric Smith @ 2008-06-20 23:54 UTC (permalink / raw)
  To: linux-kernel

Is there any method for one thread to force another thread to suspend
execution, then later let it resume, that is lighter weight than using
signals?  I don't need it to be portable to anything other than Linux.
The suspend needs to be synchronous, but resume doesn't.

What I've thought about so far (but haven't tested) for thread A
to suspend thread B is to use a signal and two pthread conditions:

    Thread A                   Thread B
    -----------------------    -----------------------
    send signal to B

    wait on a cond 1

                               enter signal handler

                               signal cond 1

                               wait on cond 2

    wake up
    do stuff that needs
    thread B suspended

    signal cond 2

    continue                   wake up


Thanks for any suggestions!
Eric Smith


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-24  7:59 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20 23:54 Any lightweight way for one thread to force another thread to suspend execution? Eric Smith
2008-06-21 14:04 ` Andi Kleen
2008-06-22  1:55   ` Eric Smith
2008-06-22  6:33     ` Bart Van Assche
2008-06-22  9:14     ` Jan Engelhardt
2008-06-23 21:08   ` Eric Smith
2008-06-24  7:59     ` Mikael Pettersson
2008-06-21 16:38 ` Bart Van Assche
2008-06-22  2:02   ` Eric Smith

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.