[lkml]   [2009]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: Suspend one thread and resume another in one system call ?
    On Wed, Aug 26, 2009 at 12:02 PM, Nikita V. Youshchenko<> wrote:
    > Hello.
    > Consider a situation when:
    > - there is a set of threads,
    > - only one of those should be allowed to work at a time,
    > - there are "switch moments" when one thread should suspend, and other
    > (known) resume.
    > "Classic" solutions like have each thread sleeping on a semaphore, and
    > making switch operation "sem_post(next_sem); sem_wait(my_sem)" cause two
    > syscalls per switch.
    > Could anyone suggest a solution with only one kernel entry per switch -
    > running thread enters kernel and is de-scheduled, new thread resumes and
    > leaves kernel?
    > Nikita
    > P.S.
    > Since there are other threads in the same application working in the
    > parallel with the mentioned "exclusive set", user-space solutions like
    > libpth are not interesting.

    If these threads are truly exclusive, just use ucontext.h's
    setcontext() to switch threads in userspace.

     \ /
      Last update: 2009-08-26 18:37    [W:0.020 / U:4.032 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site