#include <bslmt_recursivemutex.h>
This class
implements a recursive mutex (i.e., a mutex that can be locked any number of times by a thread, and then released by unlocking the mutex the same number of times). If there is an efficient native recursive mutex, this class wraps it. Otherwise, a reasonably efficient proprietary implementation is used. Note that Mutex
should be preferred if at all possible.
See bslmt_recursivemutex
◆ RecursiveMutex()
bslmt::RecursiveMutex::RecursiveMutex |
( |
| ) |
|
|
inline |
Create a recursive mutex object in the unlocked state. This method does not return normally unless there are sufficient system resources to construct the object.
◆ ~RecursiveMutex()
bslmt::RecursiveMutex::~RecursiveMutex |
( |
| ) |
|
|
inline |
◆ lock()
void bslmt::RecursiveMutex::lock |
( |
| ) |
|
|
inline |
Acquire a lock on this object. If this object is currently locked, then suspend execution of the current thread until a lock can be acquired. Succeed immediately if this thread already holds the lock.
◆ tryLock()
int bslmt::RecursiveMutex::tryLock |
( |
| ) |
|
|
inline |
Attempt to acquire a lock on this object. Return 0 on success, and a non-zero value if this object is already locked by another thread, or if an error occurs. Succeed immediately if this thread already holds the lock.
◆ unlock()
void bslmt::RecursiveMutex::unlock |
( |
| ) |
|
|
inline |
Release a lock on this object that was previously acquired through a call to lock
, or a successful call to tryLock
. To fully release the lock, a thread must invoke unlock
the same number of times it invoked lock
and tryLock
. The behavior is undefined unless the calling thread currently owns the lock on this recursive mutex.
The documentation for this class was generated from the following file: