Re: interruptible_sleep_on, interrupts and device drivers

Robert Hancock
2005-10-15T20:23:14Z

Gabriele Brugnoni wrote:
> But:
> If the test is made with IRQ closed, and IRQ are then enabled after the test
> but before the call to interruptible_sleep_on, what happen if the handler
> break the procedure immediately before entering the interruptible_sleep_on
> function ?
> I beleave that the interrupt handler, calling the wakeup function, will not
> wake our process, because is not in the waiting list. But at return from
> IRQ handler, the process will continue execution calling the sleep
> function, and nobody will wake it because the data is now already available.

This is why interruptible_sleep_on is deprecated and should not be used
anymore. The wait_event_interruptible, etc. functions avoid this race
since the condition is tested after the caller is put into the wait
queue, so if the condition is true you are guaranteed to be woken up.

--
Robert Hancock Saskatoon, SK, Canada
To email, remove "nospam" from hancockr@nospamshaw.ca
Home Page: http://www.roberthancock.com/