Re: interruptible_sleep_on, interrupts and device drivers

From: Robert Hancock
Date: Sat Oct 15 2005 - 15:31:53 EST


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@xxxxxxxxxxxxx
Home Page: http://www.roberthancock.com/

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