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 29 of file RWMutex.hpp.
|
inline |
Default Constructor.
Definition at line 49 of file RWMutex.hpp.
|
inline |
Lock on read.
Increases a reading count.
When write_lock is on a progress, wait until write_unlock to be called.
Definition at line 67 of file RWMutex.hpp.
Referenced by samchon::library::UniqueReadLock::lock(), samchon::library::SharedReadLock::lock(), and samchon::library::SharedReadLock::SharedReadLock().
|
inline |
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 90 of file RWMutex.hpp.
Referenced by samchon::library::UniqueReadLock::unlock(), samchon::library::SharedReadLock::unlock(), samchon::library::SharedReadLock::~SharedReadLock(), and samchon::library::UniqueReadLock::~UniqueReadLock().
|
inline |
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 117 of file RWMutex.hpp.
Referenced by samchon::library::UniqueWriteLock::lock(), and samchon::library::SharedWriteLock::lock().
|
inline |
Unlock on writing.
Definition at line 130 of file RWMutex.hpp.
Referenced by samchon::library::UniqueWriteLock::unlock(), samchon::library::SharedWriteLock::unlock(), samchon::library::SharedWriteLock::~SharedWriteLock(), and samchon::library::UniqueWriteLock::~UniqueWriteLock().