how does sleep waiting on an event and triggering that event work in linux - Linux

This is a discussion on how does sleep waiting on an event and triggering that event work in linux - Linux ; Hi I'm new to linux and would like to know how I can create and sleep on event in one kernel thread and have this event trigerred in another kernel thread... Thanks -Hari...

+ Reply to Thread
Results 1 to 2 of 2

Thread: how does sleep waiting on an event and triggering that event work in linux

  1. how does sleep waiting on an event and triggering that event work in linux

    Hi

    I'm new to linux and would like to know how I can create and sleep on
    event in one kernel thread and have this event trigerred in another
    kernel thread...

    Thanks
    -Hari


  2. Re: how does sleep waiting on an event and triggering that event work in linux

    hari.rulz@gmail.com wrote:
    > I'm new to linux and would like to know how I can create and sleep on
    > event in one kernel thread and have this event trigerred in another
    > kernel thread...


    The basics are:
    1. Declare wait queue head (wait_queue_head_t) and initialize.
    2. In thread that wants to sleep, call wait_event (or one of its
    variants, depending on whether you want it to be interrupted by signals
    and whether you want it to timeout eventually or wait forever) passing
    the wait queue head from 1.
    3. In triggering thread, call wake_up passing the wait queue head from
    1.

    See the definitions of wait_event* in include/linux/wait.h. You can
    also roll your own variants of all of these if necessary.

    GH


+ Reply to Thread