|
Boost Users : |
From: Johan Torp (johan_at_[hidden])
Date: 2005-10-25 08:14:49
I'm trying to implement a class having a lock and an unlock-method.
If several different threads call scoped_lock::lock, what is the effect?
class AntiRAII{
public:
AntiRAII() : mLock(mMutex, false) {}
void Lock() {mLock.lock(); }
void Unlock() {mLock.unlock();}
private:
boost::mutex mMutex;
boost::mutex::scoped_lock mLock;
};
I cannot find any documentation on the behaviour. The usual usage of
scoped_lock
is one per thread, which is why I'm sceptical to this approach.
How can this be implemented? Is it better to expose the mutex?
Regards, Johan Torp
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net