YARP
Yet Another Robot Platform
yarp::os::Mutex Class Reference

Basic wrapper for mutual exclusion. More...

#include <yarp/os/Mutex.h>

Classes

class  Private
 

Public Member Functions

 Mutex ()
 Constructor. More...
 
 ~Mutex ()
 Destructor. More...
 
void lock ()
 Lock the associated resource, waiting if necessary. More...
 
bool try_lock ()
 Lock the associated resource if possible. More...
 
void unlock ()
 Unlock the associated resource. More...
 
bool tryLock ()
 Lock the associated resource if possible. More...
 

Detailed Description

Basic wrapper for mutual exclusion.

Intended to match std::mutex in C++11, for eventual replacement by that class.

Deprecated:
since YARP 3.3. Use std::mutex instead.

Definition at line 34 of file Mutex.h.

Constructor & Destructor Documentation

◆ Mutex()

Mutex::Mutex ( )

Constructor.

Definition at line 24 of file Mutex.cpp.

◆ ~Mutex()

Mutex::~Mutex ( )

Destructor.

Definition at line 29 of file Mutex.cpp.

Member Function Documentation

◆ lock()

void Mutex::lock ( )

Lock the associated resource, waiting if necessary.

Behavior is undefined if called by the thread currently locking the resource.

Definition at line 34 of file Mutex.cpp.

◆ try_lock()

bool Mutex::try_lock ( )

Lock the associated resource if possible.

Don't wait. Behavior is undefined if called by the thread currently locking the resource.

Returns
true if the associated resource was successfully locked.

Definition at line 39 of file Mutex.cpp.

◆ tryLock()

bool Mutex::tryLock ( )

Lock the associated resource if possible.

Don't wait. Behavior is undefined if called by the thread currently locking the resource.

Returns
true if the associated resource was successfully locked.
Deprecated:
since YARP 3.0.0. Use try_lock() instead.

Definition at line 49 of file Mutex.cpp.

◆ unlock()

void Mutex::unlock ( )

Unlock the associated resource.

If the resource is not currently locked by the calling thread, the behavior is undefined.

Definition at line 44 of file Mutex.cpp.


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