Kea  1.9.9-git
isc::log::interprocess::InterprocessSyncLocker Class Reference

Interprocess Sync Locker Class. More...

#include <interprocess_sync.h>

Public Member Functions

 InterprocessSyncLocker (InterprocessSync &sync)
 Constructor. More...
 
 ~InterprocessSyncLocker ()
 Destructor. More...
 
bool isLocked () const
 Check if the lock is taken. More...
 
bool lock ()
 Acquire the lock (blocks if something else has acquired a lock on the same task name) More...
 
bool tryLock ()
 Try to acquire a lock (doesn't block) More...
 
bool unlock ()
 Release the lock. More...
 

Protected Attributes

InterprocessSyncsync_
 Ref to underlying sync object. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

isc::log::interprocess::InterprocessSyncLocker::InterprocessSyncLocker ( InterprocessSync sync)
inline

Constructor.

Creates a lock manager around a interprocess synchronization object

Parameters
syncThe sync object which has to be locked/unlocked by this locker object.

Definition at line 94 of file interprocess_sync.h.

isc::log::interprocess::InterprocessSyncLocker::~InterprocessSyncLocker ( )
inline

Destructor.

Definition at line 99 of file interprocess_sync.h.

References isLocked(), and unlock().

+ Here is the call graph for this function:

Member Function Documentation

bool isc::log::interprocess::InterprocessSyncLocker::isLocked ( ) const
inline

Check if the lock is taken.

Returns
Returns true if a lock is currently acquired, false otherwise.

Definition at line 124 of file interprocess_sync.h.

References isc::log::interprocess::InterprocessSync::is_locked_, and sync_.

Referenced by ~InterprocessSyncLocker().

bool isc::log::interprocess::InterprocessSyncLocker::lock ( )
inline

Acquire the lock (blocks if something else has acquired a lock on the same task name)

Returns
Returns true if the lock was acquired, false otherwise.

Definition at line 108 of file interprocess_sync.h.

References isc::log::interprocess::InterprocessSync::lock(), and sync_.

Referenced by isc::log::LoggerImpl::outputRaw().

+ Here is the call graph for this function:

bool isc::log::interprocess::InterprocessSyncLocker::tryLock ( )
inline

Try to acquire a lock (doesn't block)

Returns
Returns true if a new lock could be acquired, false otherwise.

Definition at line 116 of file interprocess_sync.h.

References sync_, and isc::log::interprocess::InterprocessSync::tryLock().

+ Here is the call graph for this function:

bool isc::log::interprocess::InterprocessSyncLocker::unlock ( )
inline

Release the lock.

Returns
Returns true if the lock was released, false otherwise.

Definition at line 131 of file interprocess_sync.h.

References sync_, and isc::log::interprocess::InterprocessSync::unlock().

Referenced by isc::log::LoggerImpl::outputRaw(), and ~InterprocessSyncLocker().

+ Here is the call graph for this function:

Member Data Documentation

InterprocessSync& isc::log::interprocess::InterprocessSyncLocker::sync_
protected

Ref to underlying sync object.

Definition at line 136 of file interprocess_sync.h.

Referenced by isLocked(), lock(), tryLock(), and unlock().


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