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

#include <UMutex.h>

Public Member Functions

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

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();
int unlock() const
Definition UMutex.h:120
int lock() const
Definition UMutex.h:88
See also
USemaphore

Definition at line 54 of file UMutex.h.

Constructor & Destructor Documentation

◆ UMutex()

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.

Member Function Documentation

◆ lock()

int UMutex::lock ( ) const
inline

Lock the mutex.

Returns
0 on success, an error code otherwise.

Definition at line 88 of file UMutex.h.

◆ lockTry()

int UMutex::lockTry ( ) const
inline

Try locking the mutex.

Returns
0 if the mutex has been locked by this call, EBUSY (or another error code) otherwise.

Definition at line 110 of file UMutex.h.

◆ unlock()

int UMutex::unlock ( ) const
inline

Unlock the mutex.

Returns
0 on success, an error code otherwise.

Definition at line 120 of file UMutex.h.


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