Re: sleep_on, wake_up question

Mark Mokryn (mark@psl.technion.ac.il)
Thu, 30 Dec 1999 18:24:47 +0200 (IST)


On Thu, 30 Dec 1999, Alan Cox wrote:

> Its luck on your part then. There is no provision in the system for handling
> that race using interruptible_sleep_on, because you can construct multiple
> correct solutions without having to hack the kernel up

In this case, what good is the sleep_on stuff? Wouldn't the cleaner
solution be to:
1) add an option to signal the wait queue in the wake_up function, if the
queue is empty (or perhaps even keep it signalled, even if there are
queued tasks).
2) for the sleep_on function, add an option to be immediately awoken if
entering an already signalled queue (and clear the signal).

This would hide all the ugliness, no? And prevent a lot of incorrect
drivers being written, just because some folks didn't catch on to this
race (e.g. Dick Johnson's posting).

-Mark

-
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/