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

Overview

Write lock guard around a read-write lock.

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

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

Public Member Functions

 WriteGuard (RwLock &rwlock)
 Lock an etcpal::RwLock for writing. More...
 
 WriteGuard (etcpal_rwlock_t &rwlock)
 Lock an etcpal_rwlock_t for writing. More...
 
 ~WriteGuard ()
 Release the write lock upon going out-of-scope.
 
 WriteGuard (const WriteGuard &other)=delete
 
WriteGuardoperator= (const WriteGuard &other)=delete
 
 WriteGuard (WriteGuard &&other)=delete
 
WriteGuardoperator= (WriteGuard &&other)=delete
 

Constructor & Destructor Documentation

◆ WriteGuard() [1/2]

WriteGuard ( RwLock rwlock)
inlineexplicit

Lock an etcpal::RwLock for writing.

Exceptions
std::runtime_errorif getting a write lock failed.

◆ WriteGuard() [2/2]

WriteGuard ( etcpal_rwlock_t rwlock)
inlineexplicit

Lock an etcpal_rwlock_t for writing.

Exceptions
std::runtime_errorif getting a write lock failed.

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