Samchon Framework for CPP
1.0.0
|
rw_mutex More...
#include <RWMutex.hpp>
Public Member Functions | |
RWMutex () | |
Default Constructor. More... | |
void | readLock () const |
Lock on read. More... | |
void | readUnlock () const |
Unlock of read. More... | |
void | writeLock () |
Lock on writing. More... | |
void | writeUnlock () |
Unlock on writing. More... | |
rw_mutex
A mutex divided into reading and writing.
Of course, rw_mutex is already defined in linux C. But it is dependent on the linux OS, so that cannot be compiled in Window having the rw_mutex. There's not a class like rw_mutex in STL yet. It's the reason why RWMutex is provided.
As that reason, if STL supports the rw_mutex in near future, the RWMutex can be deprecated.
Definition at line 33 of file RWMutex.hpp.
RWMutex::RWMutex | ( | ) |
Default Constructor.
Definition at line 10 of file RWMutex.cpp.
void RWMutex::readLock | ( | ) | const |
Lock on read.
Increases a reading count.
When write_lock is on a progress, wait until write_unlock to be called.
Definition at line 31 of file RWMutex.cpp.
Referenced by samchon::library::UniqueReadLock::lock(), samchon::library::SharedReadLock::SharedReadLock(), and samchon::library::UniqueReadLock::UniqueReadLock().
void RWMutex::readUnlock | ( | ) | const |
Unlock of read.
Decreases a reading count.
When write_lock had done after read_lock, it continues by read_unlock if the reading count was 1 (read_unlock makes the count to be zero).
Definition at line 39 of file RWMutex.cpp.
Referenced by samchon::library::UniqueReadLock::unlock(), and samchon::library::UniqueReadLock::~UniqueReadLock().
void RWMutex::writeLock | ( | ) |
Lock on writing.
Changes writing flag to true.
If another write_lock or read_lock is on a progress, wait until them to be unlocked.
Definition at line 53 of file RWMutex.cpp.
Referenced by samchon::library::UniqueWriteLock::lock(), samchon::library::SharedWriteLock::SharedWriteLock(), and samchon::library::UniqueWriteLock::UniqueWriteLock().
void RWMutex::writeUnlock | ( | ) |
Unlock on writing.
Definition at line 61 of file RWMutex.cpp.
Referenced by samchon::library::UniqueWriteLock::unlock(), and samchon::library::UniqueWriteLock::~UniqueWriteLock().