[lkml]   [1999]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
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

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:55    [W:0.043 / U:3.276 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site