ORIGINAL
Loading...
Searching...
No Matches
original::lockGuard Class Referenceabstract

Abstract base class for lock guard implementations. More...

#include <mutex.h>

Inheritance diagram for original::lockGuard:
Inheritance graph
Collaboration diagram for original::lockGuard:
Collaboration graph

Public Types

enum class  lockPolicy { MANUAL_LOCK , AUTO_LOCK , TRY_LOCK , ADOPT_LOCK }
 Locking policies for guard construction. More...
 

Public Member Functions

 lockGuard ()=default
 Default constructor.
 
 lockGuard (const lockGuard &)=delete
 Deleted copy constructor.
 
lockGuardoperator= (const lockGuard &)=delete
 Deleted copy assignment operator.
 
virtual ~lockGuard ()=default
 Virtual destructor.
 

Static Public Attributes

static constexpr auto MANUAL_LOCK = lockPolicy::MANUAL_LOCK
 Constant for manual lock policy.
 
static constexpr auto AUTO_LOCK = lockPolicy::AUTO_LOCK
 Constant for automatic lock policy.
 
static constexpr auto TRY_LOCK = lockPolicy::TRY_LOCK
 Constant for try-lock policy.
 
static constexpr auto ADOPT_LOCK = lockPolicy::ADOPT_LOCK
 Constant for adopt lock policy.
 

Protected Member Functions

virtual void lock ()=0
 Locks the associated mutex(es)
 
virtual bool tryLock ()=0
 Attempts to lock the associated mutex(es) without blocking.
 
virtual void unlock ()=0
 Unlocks the associated mutex(es)
 
virtual bool isLocked () const noexcept=0
 Checks if the guard currently holds the lock.
 

Detailed Description

Abstract base class for lock guard implementations.

Provides the interface for RAII-style lock management including:

  • Various locking policies (automatic, manual, try-lock)
  • Lock/unlock functionality
  • Lock state query

Member Enumeration Documentation

◆ lockPolicy

Locking policies for guard construction.

Enumerator
MANUAL_LOCK 

Don't lock automatically.

AUTO_LOCK 

Lock immediately on construction.

TRY_LOCK 

Try to lock immediately on construction.

ADOPT_LOCK 

Assume lock is already held.

Member Function Documentation

◆ isLocked()

virtual bool original::lockGuard::isLocked ( ) const
nodiscardprotectedpure virtualnoexcept

Checks if the guard currently holds the lock.

Returns
true if locked, false otherwise

Implemented in original::multiLock< MUTEX >, and original::uniqueLock.

◆ lock()

virtual void original::lockGuard::lock ( )
protectedpure virtual

Locks the associated mutex(es)

Exceptions
sysErrorif the lock operation fails

Implemented in original::multiLock< MUTEX >, and original::uniqueLock.

◆ tryLock()

virtual bool original::lockGuard::tryLock ( )
protectedpure virtual

Attempts to lock the associated mutex(es) without blocking.

Returns
true if lock was acquired, false otherwise
Exceptions
sysErrorif the operation fails

Implemented in original::multiLock< MUTEX >, and original::uniqueLock.

◆ unlock()

virtual void original::lockGuard::unlock ( )
protectedpure virtual

Unlocks the associated mutex(es)

Exceptions
sysErrorif the unlock operation fails

Implemented in original::multiLock< MUTEX >, and original::uniqueLock.


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