libASPL
Loading...
Searching...
No Matches
aspl::DoubleBuffer< T >::ReadLock Class Reference

Read lock. More...

#include <aspl/DoubleBuffer.hpp>

Public Member Functions

 ReadLock (const DoubleBuffer &doubleBuffer)
 Acquire the lock. Non-blocking and lock-free. May spin for a while if a setter is running concurrently, but wont block if the setter is suspended somewhere on the halfway.
 
 ~ReadLock ()
 Release the lock.
 
 ReadLock (ReadLock &&other)
 Move lock.
 
 ReadLock (const ReadLock &)=delete
 
ReadLockoperator= (const ReadLock &)=delete
 
ReadLockoperator= (ReadLock &&)=delete
 
const TGetReference () const
 Get read-only reference to the value. The reference may be used until read lock destructor is called. The referred value is guaranteed to be immutable until that.
 

Detailed Description

template<typename T>
class aspl::DoubleBuffer< T >::ReadLock

Read lock.

Similar to scoped locks like std::lock_guard, but also provides GetReference() method to access the value.

While the lock is alive, it's safe to access the data for reading.

Definition at line 113 of file DoubleBuffer.hpp.

Constructor & Destructor Documentation

◆ ReadLock() [1/2]

template<typename T >
aspl::DoubleBuffer< T >::ReadLock::ReadLock ( const DoubleBuffer & doubleBuffer)
inline

Acquire the lock. Non-blocking and lock-free. May spin for a while if a setter is running concurrently, but wont block if the setter is suspended somewhere on the halfway.

Definition at line 120 of file DoubleBuffer.hpp.

◆ ~ReadLock()

template<typename T >
aspl::DoubleBuffer< T >::ReadLock::~ReadLock ( )
inline

Release the lock.

Definition at line 166 of file DoubleBuffer.hpp.

◆ ReadLock() [2/2]

template<typename T >
aspl::DoubleBuffer< T >::ReadLock::ReadLock ( ReadLock && other)
inline

Move lock.

Definition at line 174 of file DoubleBuffer.hpp.

Member Function Documentation

◆ GetReference()

template<typename T >
const T & aspl::DoubleBuffer< T >::ReadLock::GetReference ( ) const
inline

Get read-only reference to the value. The reference may be used until read lock destructor is called. The referred value is guaranteed to be immutable until that.

Definition at line 187 of file DoubleBuffer.hpp.


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