Kea 2.7.5
|
Interprocess Sync Locker Class. More...
#include <interprocess_sync.h>
Public Member Functions | |
InterprocessSyncLocker (InterprocessSync &sync) | |
Constructor. | |
~InterprocessSyncLocker () | |
Destructor. | |
bool | isLocked () const |
Check if the lock is taken. | |
bool | lock () |
Acquire the lock (blocks if something else has acquired a lock on the same task name) | |
bool | tryLock () |
Try to acquire a lock (doesn't block) | |
bool | unlock () |
Release the lock. | |
Protected Attributes | |
InterprocessSync & | sync_ |
Ref to underlying sync object. | |
Interprocess Sync Locker Class.
This class is used for making automatic stack objects to manage locks that are released automatically when the block is exited (RAII). It is meant to be used along with InterprocessSync objects. See the description of InterprocessSync.
Definition at line 86 of file interprocess_sync.h.
|
inline |
Constructor.
Creates a lock manager around a interprocess synchronization object
sync | The sync object which has to be locked/unlocked by this locker object. |
Definition at line 94 of file interprocess_sync.h.
|
inline |
Destructor.
Definition at line 99 of file interprocess_sync.h.
References isLocked(), and unlock().
|
inline |
Check if the lock is taken.
Definition at line 124 of file interprocess_sync.h.
References isc::log::interprocess::InterprocessSync::is_locked_, and sync_.
Referenced by ~InterprocessSyncLocker().
|
inline |
Acquire the lock (blocks if something else has acquired a lock on the same task name)
Definition at line 108 of file interprocess_sync.h.
References isc::log::interprocess::InterprocessSync::lock(), and sync_.
|
inline |
Try to acquire a lock (doesn't block)
Definition at line 116 of file interprocess_sync.h.
References sync_, and isc::log::interprocess::InterprocessSync::tryLock().
|
inline |
Release the lock.
Definition at line 131 of file interprocess_sync.h.
References sync_, and isc::log::interprocess::InterprocessSync::unlock().
Referenced by ~InterprocessSyncLocker().
|
protected |
Ref to underlying sync object.
Definition at line 136 of file interprocess_sync.h.
Referenced by isLocked(), lock(), tryLock(), and unlock().