Implement a C++ wrapper that allows nested acquisition and release of a mutex that occurs in the same thread.
More...
#include <Recursive_Thread_Mutex.h>
Implement a C++ wrapper that allows nested acquisition and release of a mutex that occurs in the same thread.
◆ ACE_Recursive_Thread_Mutex() [1/2]
Initialize a recursive mutex.
◆ ~ACE_Recursive_Thread_Mutex()
ACE_Recursive_Thread_Mutex::~ACE_Recursive_Thread_Mutex |
( |
| ) |
|
Implicitly release a recursive mutex.
◆ ACE_Recursive_Thread_Mutex() [2/2]
◆ acquire() [1/3]
int ACE_Recursive_Thread_Mutex::acquire |
( |
| ) |
|
|
inline |
Acquire a recursive mutex (will increment the nesting level and not deadmutex if the owner of the mutex calls this method more than once).
◆ acquire() [2/3]
Block the thread until we acquire the mutex or until tv times out, in which case -1 is returned with errno
== ETIME
. Note that tv is assumed to be in "absolute" rather than "relative" time. The value of tv is updated upon return to show the actual (absolute) acquisition time.
◆ acquire() [3/3]
If tv == 0 the call acquire() directly. Otherwise, Block the thread until we acquire the mutex or until tv times out, in which case -1 is returned with errno
== ETIME
. Note that <*tv> is assumed to be in "absolute" rather than "relative" time. The value of <*tv> is updated upon return to show the actual (absolute) acquisition time.
◆ acquire_read()
int ACE_Recursive_Thread_Mutex::acquire_read |
( |
| ) |
|
|
inline |
Acquire mutex ownership. This calls acquire() and is only here to make the ACE_Recusive_Thread_Mutex interface consistent with the other synchronization APIs.
◆ acquire_write()
int ACE_Recursive_Thread_Mutex::acquire_write |
( |
| ) |
|
|
inline |
Acquire mutex ownership. This calls acquire() and is only here to make the ACE_Recusive_Thread_Mutex interface consistent with the other synchronization APIs.
◆ dump()
void ACE_Recursive_Thread_Mutex::dump |
( |
| ) |
const |
Dump the state of an object.
◆ get_nesting_level()
int ACE_Recursive_Thread_Mutex::get_nesting_level |
( |
| ) |
|
Return the nesting level of the recursion. When a thread has acquired the mutex for the first time, the nesting level == 1. The nesting level is incremented every time the thread acquires the mutex recursively. Note that if the ACE_HAS_RECURSIVE_MUTEXES macro is enabled then this method may return -1 on platforms that do not expose the internal count.
◆ get_nesting_mutex()
Returns a reference to the recursive mutex's internal mutex;.
◆ get_thread_id()
Return the id of the thread that currently owns the mutex.
◆ lock()
Returns a reference to the recursive mutex;.
◆ operator=()
◆ release()
int ACE_Recursive_Thread_Mutex::release |
( |
| ) |
|
|
inline |
Releases a recursive mutex (will not release mutex until all the nesting level drops to 0, which means the mutex is no longer held).
◆ remove()
int ACE_Recursive_Thread_Mutex::remove |
( |
| ) |
|
Implicitly release a recursive mutex. Note that only one thread should call this method since it doesn't protect against race conditions.
◆ set_thread_id()
◆ tryacquire()
int ACE_Recursive_Thread_Mutex::tryacquire |
( |
| ) |
|
|
inline |
Conditionally acquire a recursive mutex (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
◆ tryacquire_read()
int ACE_Recursive_Thread_Mutex::tryacquire_read |
( |
| ) |
|
|
inline |
Conditionally acquire mutex (i.e., won't block). This calls tryacquire() and is only here to make the ACE_Recusive_Thread_Mutex interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
◆ tryacquire_write()
int ACE_Recursive_Thread_Mutex::tryacquire_write |
( |
| ) |
|
|
inline |
Conditionally acquire mutex (i.e., won't block). This calls tryacquire() and is only here to make the ACE_Recusive_Thread_Mutex interface consistent with the other synchronization APIs. Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
◆ tryacquire_write_upgrade()
int ACE_Recursive_Thread_Mutex::tryacquire_write_upgrade |
( |
| ) |
|
|
inline |
This is only here to make the ACE_Recursive_Thread_Mutex interface consistent with the other synchronization APIs. Assumes the caller has already acquired the mutex using one of the above calls, and returns 0 (success) always.
◆ ACE_ALLOC_HOOK_DECLARE
ACE_Recursive_Thread_Mutex::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
◆ lock_
◆ removed_
bool ACE_Recursive_Thread_Mutex::removed_ |
|
protected |
Keeps track of whether remove() has been called yet to avoid multiple remove() calls, e.g., explicitly and implicitly in the destructor. This flag isn't protected by a lock, so make sure that you don't have multiple threads simultaneously calling remove() on the same object, which is a bad idea anyway...
The documentation for this class was generated from the following files: