Public Member Functions | Private Attributes | List of all members
UScopeMutex Class Reference

#include <UMutex.h>

Public Member Functions

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

Private Attributes

const UMutexmutex_
 

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 157 of file UMutex.h.

Constructor & Destructor Documentation

◆ UScopeMutex() [1/2]

UScopeMutex::UScopeMutex ( const UMutex mutex)
inline

Definition at line 160 of file UMutex.h.

◆ UScopeMutex() [2/2]

UScopeMutex::UScopeMutex ( UMutex mutex)
inline

Definition at line 166 of file UMutex.h.

◆ ~UScopeMutex()

UScopeMutex::~UScopeMutex ( )
inline

Definition at line 171 of file UMutex.h.

Member Data Documentation

◆ mutex_

const UMutex& UScopeMutex::mutex_
private

Definition at line 176 of file UMutex.h.


The documentation for this class was generated from the following file:
UScopeMutex
Definition: UMutex.h:157
UMutex
Definition: UMutex.h:54
m
Matrix3f m


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:26