ac52599eef
icansleep() violates the lock ordering due to the following cases: rbfree(): ilock(Rbpool.Lock) -> wakeup(): spli(), lock(Rbpool.Rendez) sleep(): splhi(), lock(Rbpool.Rendez) -> icansleep(): ilock(Rbpool.Lock) erik fixed this moving the wakeup() out of the ilock() in rbfree(), but i think it is an error to try acquiering a ilock in sleeps wait condition function in general. so this is what we do: in the icansleep() function, we check for the *real* event we care about; that is, if theres a buffer available in the Rbpool. this is to handle the case when rbfree() makes a buffer available *before* it sees us setting p->starve = 1. p->starve is now just used to gate rbfree() from calling wakeup() as an optimization. this might cause spurious wakeups but they are not a problem. missed wakeups is the thing we have to prevent. |
||
---|---|---|
.. | ||
doc | ||
games/lib | ||
include | ||
lib | ||
man | ||
src |