#include <Process_Mutex.h>
Collaboration diagram for ACE_Process_Mutex:

Public Methods | |
| ACE_Process_Mutex (const char *name=0, void *arg=0, mode_t mode=ACE_DEFAULT_FILE_PERMS) | |
| ACE_Process_Mutex (const wchar_t *name, void *arg=0, mode_t mode=ACE_DEFAULT_FILE_PERMS) | |
| ~ACE_Process_Mutex (void) | |
| int | remove (void) |
| int | acquire (void) |
| int | acquire (ACE_Time_Value &tv) |
| int | tryacquire (void) |
| int | release (void) |
| Release lock and unblock a thread at head of queue. More... | |
| int | acquire_read (void) |
| Acquire lock ownership (wait on queue if necessary). More... | |
| int | acquire_write (void) |
| Acquire lock ownership (wait on queue if necessary). More... | |
| int | tryacquire_read (void) |
| int | tryacquire_write (void) |
| int | tryacquire_write_upgrade (void) |
| const ACE_mutex_t & | lock (void) const |
| Return the underlying mutex. More... | |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Private Methods | |
| const ACE_TCHAR * | unique_name (void) |
| Create and return the unique name. More... | |
Private Attributes | |
| ACE_TCHAR | name_ [ACE_UNIQUE_NAME_LEN] |
| If the user does not provide a name we generate a unique name in this buffer. More... | |
| ACE_Mutex | lock_ |
ACE_Process_Mutex is based can be configured at build time to be either ACE_SV_Semaphore_Complex (on platforms that support it) or ACE_Mutex. On platforms that require interprocess mutexes be allocated from shared memory (Pthreads and UI Threads are examples), ACE_SV_Semaphore_Complex provides a more reliable mechanism for implementing inter-process mutex than ACE_Mutex. However, at least on some platforms, ACE_SV_Semaphore_Complex is limited to a small number of objects by the underlying System V IPC kernel parameters. If you want to force use of ACE_Mutex as the underlying mechanism, set ACE_USES_MUTEX_FOR_PROCESS_MUTEX in your config.h file. Also, if you require the ability to do a timed acquire(), you must set ACE_USES_MUTEX_FOR_PROCESS_MUTEX, as timed acquire does not work with System V semaphores.
Definition at line 61 of file Process_Mutex.h.
|
||||||||||||||||
|
Create a Process_Mutex, passing in the optional
Definition at line 36 of file Process_Mutex.cpp. References ACE_TEXT_CHAR_TO_TCHAR, and mode_t.
00038 : lock_ (name ? 00039 ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (), 00040 ACE_SV_Semaphore_Complex::ACE_CREATE, 00041 1, 00042 1, 00043 mode) 00044 #else 00045 : lock_ (USYNC_PROCESS, 00046 name ? 00047 ACE_TEXT_CHAR_TO_TCHAR (name) : this->unique_name (), 00048 (ACE_mutexattr_t *) arg, 00049 mode) 00050 #endif /* _ACE_USE_SV_SEM */ 00051 { 00052 #if defined (_ACE_USE_SV_SEM) 00053 ACE_UNUSED_ARG (arg); 00054 #endif /* !_ACE_USE_SV_SEM */ 00055 } |
|
||||||||||||||||
|
Create a Process_Mutex, passing in the optional
Definition at line 58 of file Process_Mutex.cpp. References ACE_TEXT_WCHAR_TO_TCHAR, and mode_t.
00062 : lock_ (name ? 00063 ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (), 00064 ACE_SV_Semaphore_Complex::ACE_CREATE, 00065 1, 00066 1, 00067 mode) 00068 #else 00069 : lock_ (USYNC_PROCESS, 00070 name ? 00071 ACE_TEXT_WCHAR_TO_TCHAR (name) : this->unique_name (), 00072 (ACE_mutexattr_t *) arg, 00073 mode) 00074 #endif /* _ACE_USE_SV_SEM */ 00075 { 00076 #if defined (_ACE_USE_SV_SEM) 00077 ACE_UNUSED_ARG (arg); 00078 #endif /* _ACE_USE_SV_SEM */ 00079 } |
|
|
Definition at line 81 of file Process_Mutex.cpp.
00082 {
00083 }
|
|
|
Acquire lock ownership, but timeout if lock if hasn't been acquired by given time.
Definition at line 29 of file Process_Mutex.inl. References ACE_Mutex::acquire, and lock_.
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 22 of file Process_Mutex.inl. References ACE_Mutex::acquire, and lock_.
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 55 of file Process_Mutex.inl. References ACE_Mutex::acquire_read, and lock_.
00056 {
00057 return this->lock_.acquire_read ();
00058 }
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 62 of file Process_Mutex.inl. References ACE_Mutex::acquire_write, and lock_.
00063 {
00064 return this->lock_.acquire_write ();
00065 }
|
|
|
Dump the state of an object.
Definition at line 18 of file Process_Mutex.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_Mutex::dump, LM_DEBUG, and lock_.
00019 {
00020 // ACE_TRACE ("ACE_Process_Mutex::dump");
00021 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00022 this->lock_.dump ();
00023 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00024 }
|
|
|
Return the underlying mutex.
Definition at line 6 of file Process_Mutex.inl. References ACE_Mutex::lock, and lock_. Referenced by ACE_WFMO_Reactor::open.
|
|
|
Release lock and unblock a thread at head of queue.
Definition at line 48 of file Process_Mutex.inl. References lock_, and ACE_Mutex::release. Referenced by ACE_WFMO_Reactor::event_handling.
|
|
|
Explicitly destroy the mutex. Note that only one thread should call this method since it doesn't protect against race conditions.
Definition at line 15 of file Process_Mutex.inl. References lock_, and ACE_Mutex::remove.
|
|
|
Conditionally acquire lock (i.e., don't wait on queue).
Definition at line 41 of file Process_Mutex.inl. References lock_, and ACE_Mutex::tryacquire.
00042 {
00043 return this->lock_.tryacquire ();
00044 }
|
|
|
Conditionally acquire a lock (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, <errno> is set to <EBUSY>. Definition at line 69 of file Process_Mutex.inl. References lock_, and ACE_Mutex::tryacquire_read.
00070 {
00071 return this->lock_.tryacquire_read ();
00072 }
|
|
|
Conditionally acquire a lock (i.e., won't block). Returns -1 on failure. If we "failed" because someone else already had the lock, <errno> is set to <EBUSY>. Definition at line 76 of file Process_Mutex.inl. References lock_, and ACE_Mutex::tryacquire_write.
00077 {
00078 return this->lock_.tryacquire_write ();
00079 }
|
|
|
This is only here for consistency with the other synchronization APIs and usability with Lock adapters. Assumes the caller already has acquired the mutex and returns 0 in all cases. Definition at line 82 of file Process_Mutex.inl.
00083 {
00084 return 0;
00085 }
|
|
|
Create and return the unique name.
Definition at line 27 of file Process_Mutex.cpp. References ACE_UNIQUE_NAME_LEN, name_, and ACE::unique_name.
00028 {
00029 // For all platforms other than Win32, we are going to create a
00030 // machine-wide unique name if one is not provided by the user. On
00031 // Win32, unnamed synchronization objects are acceptable.
00032 ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
00033 return this->name_;
00034 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 177 of file Process_Mutex.h. |
|
|
Definition at line 191 of file Process_Mutex.h. Referenced by acquire, acquire_read, acquire_write, dump, lock, release, remove, tryacquire, tryacquire_read, and tryacquire_write. |
|
|
If the user does not provide a name we generate a unique name in this buffer.
Definition at line 182 of file Process_Mutex.h. Referenced by unique_name. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002