Boost logo

Threads-Devel :

From: Allen Pulsifer (pulsifer3_at_[hidden])
Date: 2007-08-03 13:21:52

> Sort of. A waiting writer will block all new readers until
> all existing readers (or the single existing writer) are
> done. At this point, all waiting threads (readers and
> writers) will unblock and compete.

I'm not quite sure what that means. I was under the impression that the
standard way to do this is that all new readers block and the writers go one
at a time until they are all done, at which point all waiting readers can
get shared access to the resource.

If everyone unblocks, does that mean that after all existing readers are
done, one of the waiting readers can grab the mutex, then the writer starts
waiting again forcing all other readers to wait, so in effect you have the
possibility that one waiting reader goes at a time, ad infinitum, for as
long as readers continue to queue and grab the mutex before a waiting


Threads-Devel list run by bdawes at, david.abrahams at, gregod at, cpdaniel at, john at