4 #include <samchon/library/RWMutex.hpp> 74 this->reference =
new std::atomic<size_t>(0);
75 this->locked =
new std::atomic<bool>(
false);
99 this->rw_mutex = obj.rw_mutex;
100 this->reference = obj.reference;
101 this->locked = obj.locked;
104 obj.rw_mutex =
nullptr;
105 obj.reference =
nullptr;
106 obj.locked =
nullptr;
114 if (reference ==
nullptr || reference->operator--() > 0)
117 if (locked->load() ==
true)
132 if (locked->load() ==
true)
144 if (locked->load() ==
false)
148 locked->store(
false);
Shared lock from a RWMutex.
void readUnlock() const
Unlock of read.
void unlock() const
Unlock of read.
std::atomic< size_t > * reference
Referencing count sharing same RWMutex.
SharedReadLock(const SharedReadLock &obj)
Copy Constructor.
void readLock() const
Lock on read.
SharedReadLock(const RWMutex &rw_mutex, bool lock=true)
Construct from RWMutex.
const RWMutex * rw_mutex
Managed RWMutex.
SharedReadLock(SharedReadLock &&obj)
Move Constructor.
std::atomic< bool > * locked
Whether the mutex was locked by SharedReadLock.
void lock() const
Lock on read.
~SharedReadLock()
Default Destructor.