1

I am tring to implement a RWLock interface

interface IRWLock
{
    void acquireLockShared();   //< LockRead.
    void releaseLockShared();   //< UnLockRead.
    void acquireLockExclusive();    //< LockWrite.
    void releaseLockExclusive();    //< UnLockWrite.
};

by using boost::shared_mutex, boost::unique_lock and boost::shared_lock.

The problem I have is that boost::shared_lock / boost::unique_lock are using RAII and should be one instance per thread (not shared as I need). I didn't managed to break acquire and release in two separate actions as I need.

Can this be solved somehow ?

cprogrammer
  • 5,503
  • 3
  • 36
  • 56
  • How do you intend to use this interface? Anyway, "lock" classes are especially for RAII-style locking of `Lockable` concepts - if you don't need them, just call `shared_mutex` methods directly: http://www.boost.org/doc/libs/1_52_0/doc/html/thread/synchronization.html#thread.synchronization.mutex_types.shared_mutex – Igor R. Nov 07 '12 at 10:10

0 Answers0