FreeRTOS Addons
Loading...
Searching...
No Matches
Public Member Functions | List of all members
cpp_freertos::LockGuard Class Reference

#include <mutex.hpp>

Public Member Functions

 LockGuard (Mutex &m)
 
 ~LockGuard ()
 

Detailed Description

Synchronization helper class that leverages the C++ language to help prevent deadlocks. This is a C++11 feature that allows Mutex Locking and Unlocking to behave following an RAII style. The constructor of this helper object locks the Mutex. The destructor unlocks the Mutex. Since C++ guarantees that an object's desctuctor is always called when it goes out of scope, calls to Unlock become unnecessary and are in fact guaranteed as long as correct scoping is used.

Constructor & Destructor Documentation

◆ LockGuard()

LockGuard::LockGuard ( Mutex m)
explicit

Create a LockGuard with a specific Mutex.

Postcondition
The Mutex will be locked.
Note
There is an infinite timeout for acquiring the Lock.

◆ ~LockGuard()

LockGuard::~LockGuard ( )

Destroy a LockGuard.

Postcondition
The Mutex will be unlocked.

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