oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Public Member Functions | List of all members
ove::LockGuard Class Reference

Scoped RAII guard that locks a Mutex on construction and unlocks it on destruction. More...

#include <sync.hpp>

Public Member Functions

 LockGuard (Mutex &mtx)
 Constructs the guard, immediately locking the given mutex.
 
 ~LockGuard ()
 Destroys the guard, unlocking the associated mutex.
 
 LockGuard (const LockGuard &)=delete
 
LockGuardoperator= (const LockGuard &)=delete
 
 LockGuard (LockGuard &&)=delete
 
LockGuardoperator= (LockGuard &&)=delete
 

Detailed Description

Scoped RAII guard that locks a Mutex on construction and unlocks it on destruction.

This is the oveRTOS equivalent of std::lock_guard. The mutex is acquired with an indefinite timeout; a failure to acquire is treated as a fatal error via OVE_STATIC_INIT_ASSERT.

Note
Non-copyable and non-movable.

Constructor & Destructor Documentation

◆ LockGuard()

ove::LockGuard::LockGuard ( Mutex mtx)
inlineexplicit

Constructs the guard, immediately locking the given mutex.

Parameters
[in]mtxThe mutex to lock. Must outlive this guard.

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