TinyThread++: recursive_mutex Class Reference

# recursive_mutex Class Reference

Recursive mutex class. More...

`#include <tinythread.h>`

List of all members.

## Public Member Functions
| recursive_mutex ()
| Constructor.
| ~recursive_mutex ()
| Destructor.
void | lock ()
| Lock the mutex.
bool | try_lock ()
| Try to lock the mutex.
void | unlock ()
| Unlock the mutex.

## Detailed Description

Recursive mutex class.

This is a mutual exclusion object for synchronizing access to shared memory areas for several threads. The mutex is recursive (i.e. a thread may lock the mutex several times, as long as it unlocks the mutex the same number of times).

See also:
  mutex

## Member Function Documentation

void lock | ( |  | ) | `[inline]`

Lock the mutex.

The method will block the calling thread until a lock on the mutex can be obtained. The mutex remains locked until `unlock()` is called.

See also:
  lock_guard

bool try_lock | ( |  | ) | `[inline]`

Try to lock the mutex.

The method will try to lock the mutex. If it fails, the function will return immediately (non-blocking).

Returns:
  `true` if the lock was acquired, or `false` if the lock could not be acquired.

void unlock | ( |  | ) | `[inline]`

Unlock the mutex.

If any threads are waiting for the lock on this mutex, one of them will be unblocked.

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

- tinythread.h