Going to sleep atomically

Roland Dreier roland at topspincom.com
Fri Mar 9 03:42:26 EST 2001


    KD> Like in blocking read() and poll() etc?
    KD> interruptable_sleep_on() or sleep_on()

No!!  Do _not_ use sleep_on() in new code.  It isn't atomic (there is
a race condition where you will miss the wakeup).  In an earlier post
to this mailing list
(<http://lists.linuxppc.org/listarcs/linuxppc-embedded/200102/msg00093.html>)
I gave the following good advice:

    You really don't want to use sleep_on() any more (Linus wants to
    remove it for 2.5).  Take a look at

    <http://lwn.net/2001/0201/a/sleep-fix.php3>

    for a safer way to sleep, or use the wait_event macro (in
    linux/sched.h).

Roland

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/






More information about the Linuxppc-embedded mailing list