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

| Kea 3.2.0-git

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
InterprocessSync & | sync_
| 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

  sync | The sync object which has to be locked/unlocked by this locker object.

Definition at line 94 of file interprocess_sync.h.

References sync_.

## ◆ ~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 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 sync_.

Referenced by isc::dhcp::Dhcpv4Srv::getServerPort(), isc::dhcp::Dhcpv6Srv::getServerPort(), and 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.

References sync_.

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

Referenced by ~InterprocessSyncLocker(), isc::dhcp::Dhcpv4Srv::getServerPort(), isc::dhcp::Dhcpv6Srv::getServerPort(), and 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.

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

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

- interprocess_sync.h