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.
SharedWriteLock(RWMutex &rw_mutex, bool lock=true)
Construct from RWMutex.
void writeLock()
Lock on writing.
void lock()
Lock on writing.
RWMutex * rw_mutex
Managed RWMutex.
void unlock()
Unlock on writing.
~SharedWriteLock()
Default Destructor.
std::atomic< bool > * locked
Whether the mutex was locked by SharedWriteLock.
SharedWriteLock(SharedWriteLock &&obj)
Move Constructor.
void writeUnlock()
Unlock on writing.
std::atomic< size_t > * reference
Referencing count sharing same RWMutex.
SharedWriteLock(const SharedWriteLock &obj)
Copy Constructor.