#include <cel_rwlock.h>
Public Member Functions | |
| ReaderWriterLock () | |
| ~ReaderWriterLock () | |
| void | lockForRead () |
| void | lockForWrite () |
| void | unlock () |
This class implements typical Reader-Writer lock. The Reader-Writer lock is used in the situation which meets the following conditions:
You can use this class as auto variable like the following code:
ReaderWriterLock g_rwlock; SomeSharedObject g_something; // some shared object void writeFunc() { WriterLock lock(g_rwlock); // write access g_something.do_something_like_write(...); } void readFunc() { ReaderLock lock(g_rwlock); // read-only access g_something.do_something_like_read(...); }
| Celartem::ReaderWriterLock::ReaderWriterLock | ( | ) | [inline] |
Initializes the instance.
| Celartem::ReaderWriterLock::~ReaderWriterLock | ( | ) | [inline] |
Uninitialize the instance.
| void Celartem::ReaderWriterLock::lockForRead | ( | ) | [inline] |
Lock for read access.
Referenced by Celartem::ReaderWriterLockLockerTempl< isWriter >::lock(), and Celartem::RWLock::lock().
| void Celartem::ReaderWriterLock::lockForWrite | ( | ) | [inline] |
Lock for write access.
Referenced by Celartem::ReaderWriterLockLockerTempl< isWriter >::lock(), and Celartem::RWLock::lock().
| void Celartem::ReaderWriterLock::unlock | ( | ) | [inline] |
Unlock the last lock (either of read or write).
Referenced by Celartem::ReaderWriterLockLockerTempl< isWriter >::unlock(), and Celartem::RWLock::unlock().