Kea 2.7.6
isc::log::interprocess::InterprocessSyncLocker Class Reference

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

InterprocessSyncsync_
 Ref to underlying sync object.
 

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 isLocked(), and 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.

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

Referenced by ~InterprocessSyncLocker().

◆ 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.

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

Referenced by isc::dhcp::Dhcpv4Srv::getServerPort(), isc::dhcp::Dhcpv6Srv::getServerPort(), and isc::log::LoggerImpl::outputRaw().

+ Here is the call graph for this function:

◆ 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.

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

+ Here is the call graph for this function:

◆ 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.

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

Referenced by ~InterprocessSyncLocker(), isc::dhcp::Dhcpv4Srv::getServerPort(), isc::dhcp::Dhcpv6Srv::getServerPort(), and isc::log::LoggerImpl::outputRaw().

+ Here is the call graph for this function:

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.

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


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