lkml.org 
[lkml]   [1999]   [Dec]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: sleep_on, wake_up question
Date
From: "Richard B. Johnson" <root@chaos.analogic.com>
>
> 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
contexts.
--
Manfred





-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site