
Messages in this thread
SubjectRe: sleep_on, wake_up question
From: "Richard B. Johnson" <>
> There is more at work than your code implies. If the interrupt occurs
> instantly, before your call to interruptible_sleep_on(), the call will
> return immediately. It works. I have many drivers using this technique
> and they have never missed a beat.
No. Do not use sleep_on() in new drivers. sleep_on() can miss interrupts
unless you own the global interrupt lock(*). Your driver could fail on SMP.

Please use either wait_event() [only possible if you don't use spinlocks],
or manually implement sleep_on(): [wait_event() + spin_unlock_irq() just
before schedule() + spin_lock_irq() just behind schedule()].

It's implemented in <linux/sched.h> for both 2.2 and 2.3

(*) or lock_kernel(), but this is only possible from outside interrupt

the body of a message to
Please read the FAQ at

 \ /
©2003-2011 Jasper Spaans