C++ TargetRTS
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
RTLock Class Reference

Special utility class that allows to protect a piece of code from being accessed by multiple execution threads at the same time. More...

#include <RTLock.h>

Public Member Functions

 RTLock (RTMutex &mutex)
 

Protected Attributes

RTMutex & _mutex
 

Detailed Description

Special utility class that allows to protect a piece of code from being accessed by multiple execution threads at the same time.

Critical section starts when RTLock object is constructed, and continues until the end of a C++ block or until a function return statement.

A typical use case is to declare a static mutex and an object of RTLock class in the beginning of a code block or a function:

{
#if USE_THREADS
static RTMutex mutex;
RTLock lock(mutex);
#endif
// critical section
}
Special utility class that allows to protect a piece of code from being accessed by multiple executio...
Definition: RTLock.h:29

Mutex is released when RTLock object is destroyed.


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