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>
wcm> It supports the basic interface:
wcm>
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>
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>
wcm> -Wayne Miller
wcm>
wcm> To unsubscribe, send email to: <mailto:boost-unsubscribe_at_[hidden]>
wcm>
wcm>
wcm> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
wcm>
wcm>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk