EtcPal  HEAD (unstable)
ETC Platform Abstraction Layer (EtcPal)
View other versions:
ReadGuard Class Reference

Overview

Read lock guard around a read-write lock.

Read lock is taken when this class is instantiated, and released when it goes out of scope. Example usage:

void Class::CriticalFunction()
{
etcpal::ReadGuard read_lock(rwlock_);
// Do critical read operations here
// Lock is released when it goes out of scope
}
Read lock guard around a read-write lock.
Definition: rwlock.h:232

Public Member Functions

 ReadGuard (RwLock &rwlock)
 Lock an etcpal::RwLock for reading. More...
 
 ReadGuard (etcpal_rwlock_t &rwlock)
 Lock an etcpal_rwlock_t for reading. More...
 
 ~ReadGuard ()
 Release the read lock upon going out-of-scope.
 
 ReadGuard (const ReadGuard &other)=delete
 
ReadGuardoperator= (const ReadGuard &other)=delete
 
 ReadGuard (ReadGuard &&other)=delete
 
ReadGuardoperator= (ReadGuard &&other)=delete
 

Constructor & Destructor Documentation

◆ ReadGuard() [1/2]

ReadGuard ( RwLock rwlock)
inlineexplicit

Lock an etcpal::RwLock for reading.

Exceptions
std::runtime_errorif getting a read lock failed.

◆ ReadGuard() [2/2]

ReadGuard ( etcpal_rwlock_t rwlock)
inlineexplicit

Lock an etcpal_rwlock_t for reading.

Exceptions
std::runtime_errorif getting a read lock failed.

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