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

#include <UMutex.h>

Public Member Functions

int lock () const
 
int lockTry () const
 
 UMutex ()
 
int unlock () const
 
virtual ~UMutex ()
 

Private Member Functions

void operator= (UMutex &)
 
 UMutex (const UMutex &)
 

Private Attributes

pthread_mutex_t M
 

Detailed Description

A mutex class.

On a lock() call, the calling thread is blocked if the UMutex was previously locked by another thread. It is unblocked when unlock() is called.

On Unix (not yet tested on Windows), UMutex is recursive: the same thread can call multiple times lock() without being blocked.

Example:

UMutex m; // Mutex shared with another thread(s).
...
m.lock();
// Data is protected here from the second thread
//(assuming the second one protects also with the same mutex the same data).
m.unlock();
See also
USemaphore

Definition at line 54 of file UMutex.h.

Constructor & Destructor Documentation

◆ UMutex() [1/2]

UMutex::UMutex ( )
inline

The constructor.

Definition at line 62 of file UMutex.h.

◆ ~UMutex()

virtual UMutex::~UMutex ( )
inlinevirtual

Definition at line 75 of file UMutex.h.

◆ UMutex() [2/2]

UMutex::UMutex ( const UMutex )
inlineprivate

Definition at line 129 of file UMutex.h.

Member Function Documentation

◆ lock()

int UMutex::lock ( ) const
inline

Lock the mutex.

Definition at line 87 of file UMutex.h.

◆ lockTry()

int UMutex::lockTry ( ) const
inline

Definition at line 104 of file UMutex.h.

◆ operator=()

void UMutex::operator= ( UMutex )
inlineprivate

Definition at line 128 of file UMutex.h.

◆ unlock()

int UMutex::unlock ( ) const
inline

Unlock the mutex.

Definition at line 113 of file UMutex.h.

Member Data Documentation

◆ M

pthread_mutex_t UMutex::M
mutableprivate

Definition at line 126 of file UMutex.h.


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


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