# Re: Going to sleep atomically

- From: Roland Dreier \<hidden\>
- Date: 2001-03-08 16:42:26 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2001/03/9375918
- Thread: https://ratatoskr.run/linuxppc-dev/2001/03/9375918/t.md

```text

    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/
```
