First page Back Continue Last page Overview Graphics
How to sleep (2)
Several ways to make a kernel process sleep
Sleeps until the task is woken up and the given C expression is true.
Caution: can't be interrupted (can't kill the user-space process!)
int wait_event_killable(queue, condition); (Since Linux 2.6.25)
Can be interrupted, but only by a “fatal” signal (SIGKILL). Returns -ERESTARSYS if interrupted.
int wait_event_interruptible(queue, condition);
Can be interrupted by any signal. Returns -ERESTARTSYS if interrupted.
int wait_event_timeout(queue, condition, timeout);
Also stops sleeping when the task is woken up and the timeout expired. Returns 0 if the timeout elapsed, non-zero if the condition was met.
int wait_event_interruptible_timeout(queue, condition, timeout);
Same as above, interruptible. Returns 0 if the timeout elapsed, -ERESTARTSYS if interrupted, positive value if the condition was met