RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
UScopeMutex Class Reference

#include <UMutex.h>

Public Member Functions

 UScopeMutex (const UMutex &mutex)
 
 UScopeMutex (UMutex *mutex)
 

Detailed Description

Automatically lock the referenced mutex on constructor and unlock mutex on destructor.

Example:

UMutex m; // Mutex shared with another thread(s).
...
int myMethod()
{
UScopeMutex sm(m); // automatically lock the mutex m
if(cond1)
{
return 1; // automatically unlock the mutex m
}
else if(cond2)
{
return 2; // automatically unlock the mutex m
}
return 0; // automatically unlock the mutex m
}
See also
UMutex

Definition at line 164 of file UMutex.h.

Constructor & Destructor Documentation

◆ UScopeMutex() [1/2]

UScopeMutex::UScopeMutex ( const UMutex mutex)
inline

Definition at line 167 of file UMutex.h.

◆ UScopeMutex() [2/2]

UScopeMutex::UScopeMutex ( UMutex mutex)
inline

Definition at line 173 of file UMutex.h.

◆ ~UScopeMutex()

UScopeMutex::~UScopeMutex ( )
inline

Definition at line 178 of file UMutex.h.


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