Boost logo

Boost :

From: Wayne Miller (wcm_at_[hidden])
Date: 2001-04-25 16:26:26


I had these ideas for interface compromises:

Since the const/non-const interface seems to be unpopular, what do you think
about this instead:

void lock_read();
void lock_write();
void unlock_read();
void unlock_write();

And then supply these adaptors:

template <class LOCK>
class MonitorAdaptor
{
    mutable LOCK lock;
public:
    void lock() {lock_write();}
    void unlock() {unlock_write();}
    void lock() const {lock_read();}
    void unlock() const {unlock_read();}
};

class BoostReadWriter : public ReaderWriter<BoostSemaphore, BoostMutex>
{
};

Perhaps this would solve concerns about the template parameter dangers?


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