Fawkes API  Fawkes Development Version
fawkes::RefCountRWLock Class Reference

Read/write lock with reference counting. More...

#include <core/threading/refc_rwlock.h>

Inheritance diagram for fawkes::RefCountRWLock:

Public Member Functions

 RefCountRWLock (ReadWriteLock::ReadWriteLockPolicy policy=ReadWriteLock::RWLockPolicyPreferWriter)
 Constructor. More...
 
virtual ~RefCountRWLock ()
 Destructor. More...
 
- Public Member Functions inherited from fawkes::ReadWriteLock
 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...
 
- Public Member Functions inherited from fawkes::RefCount
 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

- Public Types inherited from fawkes::ReadWriteLock
enum  ReadWriteLockPolicy { RWLockPolicyPreferWriter, RWLockPolicyPreferReader }
 The policy to use for the read/write lock. More...
 

Detailed Description

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.

See also
ReadWriteLock
RefCount
Author
Tim Niemueller

Definition at line 33 of file refc_rwlock.h.

Constructor & Destructor Documentation

◆ RefCountRWLock()

fawkes::RefCountRWLock::RefCountRWLock ( ReadWriteLock::ReadWriteLockPolicy  policy = ReadWriteLock::RWLockPolicyPreferWriter)

Constructor.

Parameters
policyPolicy, see ReadWriteLock::ReadWriteLock() for more info on this.

Definition at line 44 of file refc_rwlock.cpp.

◆ ~RefCountRWLock()

fawkes::RefCountRWLock::~RefCountRWLock ( )
virtual

Destructor.

Definition at line 50 of file refc_rwlock.cpp.


The documentation for this class was generated from the following files: