>
> Indeed. One way to catch sleep() errors is to change wakeup() to wake
> *everyone* up.
i was thinking on this and it occurred to me ....
to make the point by absurdity, consider this approximation
of sleep and wakeup without notes.
void
sleep(Rendez*, void (*)(void*), void*)
{
}
void
wakeup(Rendez*)
{
}
these have the property that you may wake without the condition
but you may not miss a wakeup. it also doesn't matter if the condition
happens while sleep is executing. and there is no hazard between
the two. so i think this impemenation does satisfy the all
the requirements!
i didn't say it was efficient. :-)
i think what cinap is thinking is, how could devmnt's particular
use of sleep/wakeup with this particular implementation of sleep/wakeup
evade handling spurious wakeups. if that's what the thought is,
i would resist it. it may be that someone thinks of a very efficient
way of re-implementing sleep/wakeup that may have slightly different
properties. as long as the client and sleep/wakeup play by the rules,
this should not be a problem. (it's possible to do plan 9-style sleep
wakeup within, say, the windows kernel.)
- erik