
23 Apr
2008
23 Apr
'08
1:15 p.m.
Anthony Williams:
shared_mutex algorithms are *hard* to get right.
I'm now tending towards the opinion that rwlocks are hard to use correctly (and test). For the 2R+1W case I've been testing, it occurs to me that the writer wait time is normal - statistically, the time for the two readers to finish their timeslices of 1ms is expected to be 0.75ms. A (possibly?) better test would not have a dedicated writer thread, but would use a pool of generic worker threads that alternate between reading and writing with a certain probability. I may try one at some point.