ACE_Thread_Mutex wrapper (only valid for threads in the same process).
More...
#include <Thread_Mutex.h>
ACE_Thread_Mutex wrapper (only valid for threads in the same process).
This implementation is optimized for locking threads that are in the same process. It maps to <CRITICAL_SECTION>s on NT and <ACE_mutex_t> with <type> set to <USYNC_THREAD> on UNIX. ACE_Thread_Mutex is recursive on some platforms (like Win32). However, on most platforms it is not recursive. To be totally safe and portable, developers should use ACE_Recursive_Thread_Mutex when they need a recursive mutex.
◆ ACE_Thread_Mutex() [1/2]
◆ ~ACE_Thread_Mutex()
ACE_Thread_Mutex::~ACE_Thread_Mutex |
( |
| ) |
|
Implicitly destroy the mutex.
◆ ACE_Thread_Mutex() [2/2]
◆ acquire() [1/3]
int ACE_Thread_Mutex::acquire |
( |
| ) |
|
|
inline |
Acquire lock ownership (wait on queue if necessary).
◆ 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_Thread_Mutex::acquire_read |
( |
| ) |
|
|
inline |
Acquire mutex ownership. This calls acquire() and is only here to make the ACE_Thread_Mutex interface consistent with the other synchronization APIs.
◆ acquire_write()
int ACE_Thread_Mutex::acquire_write |
( |
| ) |
|
|
inline |
Acquire mutex ownership. This calls acquire() and is only here to make the ACE_Thread_Mutex interface consistent with the other synchronization APIs.
◆ dump()
void ACE_Thread_Mutex::dump |
( |
| ) |
const |
Dump the state of an object.
◆ lock() [1/2]
◆ lock() [2/2]
Return the underlying mutex.
◆ operator=()
◆ release()
int ACE_Thread_Mutex::release |
( |
| ) |
|
|
inline |
Release lock and unblock a thread at head of queue.
◆ remove()
int ACE_Thread_Mutex::remove |
( |
| ) |
|
|
inline |
Explicitly destroy the mutex. Note that only one thread should call this method since it doesn't protect against race conditions.
◆ tryacquire()
int ACE_Thread_Mutex::tryacquire |
( |
| ) |
|
|
inline |
Conditionally acquire lock (i.e., don't wait on queue). Returns -1 on failure. If we "failed" because someone else already had the lock, errno
is set to EBUSY
.
◆ tryacquire_read()
int ACE_Thread_Mutex::tryacquire_read |
( |
| ) |
|
|
inline |
Conditionally acquire mutex (i.e., won't block). This calls tryacquire() and is only here to make the ACE_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_Thread_Mutex::tryacquire_write |
( |
| ) |
|
|
inline |
Conditionally acquire mutex (i.e., won't block). This calls tryacquire() and is only here to make the ACE_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_Thread_Mutex::tryacquire_write_upgrade |
( |
| ) |
|
|
inline |
This is only here to make the ACE_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_Thread_Mutex::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
◆ lock_
Mutex type that supports single-process locking efficiently.
◆ removed_
bool ACE_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: