Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-04-24 17:33:19

Does your r/w lock give priority to readers or writers (or neither)?

On Tue, 24 Apr 2001, Wayne Miller wrote:

wcm> I'd like to propose this reader-writer lock as an addition to the boost
wcm> library.
wcm> It supports the basic interface:
wcm> void lock();
wcm> void unlock();
wcm> void lock() const;
wcm> void unlock() const;

It seems a little odd to use const'ness to indicate reader versus a
writer. This may be ok when the lock is a data member of the object being
accessed, but this doesn't have to be the case. The lock object and the
accessed object may not be tied together, and their const'ness could be
independent of eachother.

wcm> Any number of threads are allowed into the critical section if
wcm> the const version of lock is used, but at most one thread is
wcm> allowed into the critical section if the non-const versions is
wcm> called.
wcm> The lock is implemented as a template that takes two parameters, an object
wcm> type SEMAPHORE, and an object type MUTEX. These are trivial objects that
wcm> both must support the interface lock and unlock.
wcm> -Wayne Miller
wcm> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
wcm> Your use of Yahoo! Groups is subject to

 Jeremy Siek www:
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906

Boost list run by bdawes at, gregod at, cpdaniel at, john at