Kea  2.3.5-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

◆ InterprocessSyncLocker()

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.

◆ ~InterprocessSyncLocker()

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

Destructor.

Definition at line 99 of file interprocess_sync.h.

References isc::log::interprocess::InterprocessSync::unlock().

+ Here is the call graph for this function:

Member Function Documentation

◆ isLocked()

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.

◆ lock()

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.

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

◆ tryLock()

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.

◆ unlock()

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.

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

Member Data Documentation

◆ sync_

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

Ref to underlying sync object.

Definition at line 136 of file interprocess_sync.h.


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