Base Framework
Public Member Functions | List of all members
ReadWriteSpinLock Class Reference

Read-write synchronization object. More...

#include <base/concurrency/ReadWriteSpinLock.h>

Public Member Functions

 ReadWriteSpinLock () noexcept
 
void exclusiveLock () const noexcept
 
bool tryExclusiveLock () const noexcept
 
void sharedLock () const noexcept
 
bool trySharedLock () const noexcept
 
void releaseLock () const noexcept
 

Detailed Description

Read-write synchronization object.

This class implements a read-write lock for optimal reader performance on systems. Please note that the lock/unlock mechanism is considered a non-modifying property of a class.

See also
MutualExclusion ReadWriteLock SpinLock
Version
1.0

Constructor & Destructor Documentation

◆ ReadWriteSpinLock()

ReadWriteSpinLock::ReadWriteSpinLock ( )
noexcept

Initializes the spin lock in unlocked state.

Member Function Documentation

◆ exclusiveLock()

void ReadWriteSpinLock::exclusiveLock ( ) const
noexcept

Acquires an exclusive lock.

◆ releaseLock()

void ReadWriteSpinLock::releaseLock ( ) const
noexcept

Releases the spin lock.

◆ sharedLock()

void ReadWriteSpinLock::sharedLock ( ) const
inlinenoexcept

Acquires a shared lock.

◆ tryExclusiveLock()

bool ReadWriteSpinLock::tryExclusiveLock ( ) const
noexcept

Tries to acquire an exclusive lock.

Returns
True on success.

◆ trySharedLock()

bool ReadWriteSpinLock::trySharedLock ( ) const
noexcept

Tries to acquire a shared lock.

Returns
True on success.