#include <Thread_Mutex.h>
Public Methods | |
ACE_Thread_Mutex (const ACE_TCHAR *name=0, ACE_mutexattr_t *attributes=0) | |
Constructor. | |
~ACE_Thread_Mutex (void) | |
Implicitly destroy the mutex. | |
int | remove (void) |
int | acquire (void) |
Acquire lock ownership (wait on queue if necessary). | |
int | acquire (ACE_Time_Value &tv) |
int | acquire (ACE_Time_Value *tv) |
int | tryacquire (void) |
int | release (void) |
Release lock and unblock a thread at head of queue. | |
int | acquire_read (void) |
int | acquire_write (void) |
int | tryacquire_read (void) |
int | tryacquire_write (void) |
int | tryacquire_write_upgrade (void) |
const ACE_thread_mutex_t & | lock (void) const |
Return the underlying mutex. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
ACE_thread_mutex_t | lock_ |
Mutex type that supports single-process locking efficiently. | |
int | removed_ |
Private Methods | |
void | operator= (const ACE_Thread_Mutex &) |
ACE_Thread_Mutex (const ACE_Thread_Mutex &) | |
Friends | |
class | ACE_Condition_Thread_Mutex |
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 (like Solaris) it is not recursive. To be totally safe and portable, developers should use <ACE_Recursive_Thread_Mutex> when they need a recursive mutex.
|
Constructor.
|
|
Implicitly destroy the mutex.
|
|
|
|
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. |
|
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 lock ownership (wait on queue if necessary).
|
|
Acquire mutex ownership. This calls <acquire> and is only here to make the <ACE_Thread_Mutex> interface consistent with the other synchronization APIs. |
|
Acquire mutex ownership. This calls <acquire> and is only here to make the <ACE_Thread_Mutex> interface consistent with the other synchronization APIs. |
|
Dump the state of an object.
|
|
Return the underlying mutex.
|
|
|
|
Release lock and unblock a thread at head of queue.
|
|
Explicitly destroy the mutex. Note that only one thread should call this method since it doesn't protect against race conditions. |
|
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>. |
|
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>. |
|
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>. |
|
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. |
|
|
|
Declare the dynamic allocation hooks.
|
|
Mutex type that supports single-process locking efficiently.
|
|
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... |