I've got a problem on using interruptible_sleep_on(). I hope
you will help me fix that ;-)
I want to wait for a task to finish :
----------------------------------
if(my_condition == TRUE)
interruptible_sleep_on(&my_wait_queue);
----------------------------------
Then, at some point, a timer/BH/soft-irq will do :
-------------------------------
my_condition == FALSE;
wake_up_interruptible(&my_wait_queue);
-------------------------------
It seems straightforward, but it doesn't work. There is a race
condition between the test of the condition and the call to
sleep_on().
I looked at it in every possible way, and I don't see how it
is possible to use safely interruptible_sleep_on(). And I wonder :
what's the point of having a function in the kernel if you can't use
it safely ?
As a matter of fact, the TCP code doesn't use
interruptible_sleep_on() but use some complex code around schedule()
(and there must be a simpler and cleaner solution for such a simple
problem).
Any comments ?
Jean
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/