
On Aug 9, 2004, at 5:30 PM, Alexander Terekhov wrote:
Howard Hinnant wrote: [...]
The alternative in this link looks very familiar. I'm currently using two condition variables, ...
POSIX condition variables strive for "wait-morphing". So you'll end up with "serial wakes" (quite a waste on, say, 32-way box). The problem is that waiters must reacquire the mutex. tail_* stuff is supposed to NOT have this requirement (it's meant to use the associated mutex for waiters queue "protection"... a la Java monitors, in a way). Well, take also a look at:
http://www.cs.rochester.edu/u/scott/synchronization/pseudocode/rw.html
Ok, I think I understand now. You are expediting the "thundering herd" of waiting readers when a writer unlocks on a multi-processor. Thanks, Howard