Boost logo

Boost :

From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-04-25 11:21:54


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

I believe that this functionality could be useful, but I've got the
following comments on this specific proposal:

 - needs boostification
 - should use the structure and terminology of the draft Boost.Thread
library (for example, your "Guard" is a "lock" in Boost.Thread, so naming
something mutex-like a "...Lock" in boost context is misleading)
 - As others already said, using "const" for this interface is wrong,
because the lock is actually changed. read_lock() and write_lock() seem
better.
 - should provide what you call a "Guard" (one each for read_lock and
write_lock) so that nobody forgets to unlock
 - should provide a (preferably non-trivial) demonstration program to
show the usefulness
 - should provide a test program to check that it works correctly
 - please read http://www.boost.org/more/lib_guide.htm

Jens Maurer


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