YARP  2.3.70.1
Yet Another Robot Platform
yarp::os::RecursiveMutex Class Reference

RecursiveMutex offers exclusive, recursive ownership semantics: More...

#include <yarp/os/RecursiveMutex.h>

Public Member Functions

 RecursiveMutex ()
 Constructor. More...
 
 ~RecursiveMutex ()
 Destructor. More...
 
void lock ()
 Lock the associated resource, waiting if the resource is busy. More...
 
bool tryLock ()
 Lock the associated resource if it is free. More...
 
void unlock ()
 Unlock the associated resource thus freeing waiting threads. More...
 

Private Attributes

void * implementation
 

Detailed Description

RecursiveMutex offers exclusive, recursive ownership semantics:

  • A calling thread owns a RecursiveMutex for a period of time that starts when it successfully calls either lock or tryLock. During this period, the thread may make additional calls to lock or tryLock. The period of ownership ends when the thread makes a matching number of calls to unlock.
  • When a thread owns a RecursiveMutex, all other threads will block (for calls to lock) or receive a false return value (for tryLock) if they attempt to claim ownership of the RecursiveLock. The behavior of a program is undefined if a RecursiveMutex is destroyed while still owned by some thread. The behavior of a program is undefined if a RecursiveMutex is unlocked by a thread which is not currently owning the RecursiveMutex

Definition at line 33 of file RecursiveMutex.h.

Constructor & Destructor Documentation

◆ RecursiveMutex()

RecursiveMutex::RecursiveMutex ( )

Constructor.

Definition at line 14 of file RecursiveMutex.cpp.

◆ ~RecursiveMutex()

RecursiveMutex::~RecursiveMutex ( )

Destructor.

Definition at line 19 of file RecursiveMutex.cpp.

Member Function Documentation

◆ lock()

void RecursiveMutex::lock ( )

Lock the associated resource, waiting if the resource is busy.

If the thread which is currently owning the resource calls this function, it will not block, and a reference count will be increased Thu number of calls to lock() must be balanced by the same number of calls to unlock()

Definition at line 27 of file RecursiveMutex.cpp.

◆ tryLock()

bool RecursiveMutex::tryLock ( )

Lock the associated resource if it is free.

See also
RecursiveLock::lock() for more detailed description
Returns
true if the associated resource was successfully locked. False otherwise

Definition at line 32 of file RecursiveMutex.cpp.

◆ unlock()

void RecursiveMutex::unlock ( )

Unlock the associated resource thus freeing waiting threads.

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

Definition at line 37 of file RecursiveMutex.cpp.

Member Data Documentation

◆ implementation

void* yarp::os::RecursiveMutex::implementation
private

Definition at line 80 of file RecursiveMutex.h.


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