Fawkes API
Fawkes Development Version
|
Read/write lock with reference counting. More...
#include <core/threading/refc_rwlock.h>
Public Member Functions | |
RefCountRWLock (ReadWriteLock::ReadWriteLockPolicy policy=ReadWriteLock::RWLockPolicyPreferWriter) | |
Constructor. More... | |
virtual | ~RefCountRWLock () |
Destructor. More... | |
![]() | |
ReadWriteLock (ReadWriteLockPolicy policy=RWLockPolicyPreferWriter) | |
Constructor. More... | |
virtual | ~ReadWriteLock () |
Destructor. More... | |
void | lock_for_read () |
Aquire a reader lock. More... | |
void | lock_for_write () |
Aquire a writer lock. More... | |
bool | try_lock_for_read () |
Tries to aquire a reader lock. More... | |
bool | try_lock_for_write () |
Tries to aquire a writer lock. More... | |
void | unlock () |
Release the lock. More... | |
![]() | |
RefCount () | |
Constructor. More... | |
virtual | ~RefCount () |
Destructor. More... | |
void | ref () |
Increment reference count. More... | |
void | unref () |
Decrement reference count and conditionally delete this instance. More... | |
unsigned int | refcount () |
Get reference count for this instance. More... | |
Additional Inherited Members | |
![]() | |
enum | ReadWriteLockPolicy { RWLockPolicyPreferWriter, RWLockPolicyPreferReader } |
The policy to use for the read/write lock. More... | |
Read/write lock with reference counting.
This class is a combination of ReadWriteLock and RefCount. A reference count is maintained for the class to allow for automatic destruction when the last user calls unref(). The class otherwise acts as a normal ReadWriteLock, you just should not delete the instance but rather unref() it.
Definition at line 33 of file refc_rwlock.h.
fawkes::RefCountRWLock::RefCountRWLock | ( | ReadWriteLock::ReadWriteLockPolicy | policy = ReadWriteLock::RWLockPolicyPreferWriter | ) |
Constructor.
policy | Policy, see ReadWriteLock::ReadWriteLock() for more info on this. |
Definition at line 44 of file refc_rwlock.cpp.
|
virtual |
Destructor.
Definition at line 50 of file refc_rwlock.cpp.