Boost logo

Boost :

From: williamkempf_at_[hidden]
Date: 2001-04-25 09:43:47

--- In boost_at_y..., "Wayne Miller" <wcm_at_e...> wrote:
> I'd like to propose this reader-writer lock as an addition to the
> library.

Reader/writer locks are planned for Phase II of Boost.Threads.

> It supports the basic interface:
> void lock();
> void unlock();
> void lock() const;
> void unlock() const;
> Any number of threads are allowed into the critical section if the
> version of lock is used, but at most one thread is allowed into the
> section if the non-const versions is called.

Using the const-ness of the object to distinguish between read and
write locks is, IMHO, a very bad idea, especially since locking
changes the object's state.
> The lock is implemented as a template that takes two parameters, an
> type SEMAPHORE, and an object type MUTEX. These are trivial objects
> both must support the interface lock and unlock.

This sort of parameterization of the type sounds very dangerous to me.

Bill Kempf

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