#include <RW_Process_Mutex.h>
Collaboration diagram for ACE_RW_Process_Mutex:

Public Methods | |
| ACE_RW_Process_Mutex (const ACE_TCHAR *name=0, int flags=O_CREAT|O_RDWR) | |
| Create a readers/writer <Process_Mutex>, passing in the optional <name>. If not specified, a name is generated. More... | |
| ~ACE_RW_Process_Mutex (void) | |
| int | remove (void) |
| int | acquire (void) |
| Acquire lock ownership (wait on queue if necessary). More... | |
| 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) |
| Attempt to upgrade a read lock to a write lock. Returns 0 on success, -1 on failure. More... | |
| const ACE_File_Lock & | lock (void) const |
| Return the underlying lock. 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_File_Lock | lock_ |
| We need this to get the readers/writer semantics... More... | |
Note that because this class uses the <ACE_File_Lock> as its implementation it only can be reliably used between separate processes, rather than threads in the same process. This isn't a limitation of ACE, it's simply the file lock semantics on UNIX and Win32.
Definition at line 34 of file RW_Process_Mutex.h.
|
||||||||||||
|
Create a readers/writer <Process_Mutex>, passing in the optional <name>. If not specified, a name is generated.
Definition at line 23 of file RW_Process_Mutex.cpp. References ACE_DEFAULT_OPEN_PERMS, and ACE_TCHAR.
00025 : lock_ (name ? name : this->unique_name (), flags 00026 #if defined (ACE_WIN32) 00027 , ACE_DEFAULT_OPEN_PERMS) 00028 #else 00029 , S_IRUSR | S_IWUSR) 00030 #endif /* ACE_WIN32 */ 00031 { 00032 // ACE_TRACE ("ACE_RW_Process_Mutex::ACE_RW_Process_Mutex"); 00033 } |
|
|
Definition at line 35 of file RW_Process_Mutex.cpp.
00036 {
00037 // ACE_TRACE ("ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex");
00038 }
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 13 of file RW_Process_Mutex.inl. References ACE_File_Lock::acquire, and lock_.
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 34 of file RW_Process_Mutex.inl. References ACE_File_Lock::acquire_read, and lock_.
00035 {
00036 return this->lock_.acquire_read ();
00037 }
|
|
|
Acquire lock ownership (wait on queue if necessary).
Definition at line 41 of file RW_Process_Mutex.inl. References ACE_File_Lock::acquire_write, and lock_.
00042 {
00043 return this->lock_.acquire_write ();
00044 }
|
|
|
Dump the state of an object.
Definition at line 41 of file RW_Process_Mutex.cpp. References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_File_Lock::dump, LM_DEBUG, and lock_.
00042 {
00043 // ACE_TRACE ("ACE_RW_Process_Mutex::dump");
00044 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00045 this->lock_.dump ();
00046 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00047 }
|
|
|
Return the underlying lock.
Definition at line 68 of file RW_Process_Mutex.inl. References lock_.
00069 {
00070 // ACE_TRACE ("ACE_RW_Process_Mutex::lock");
00071 return this->lock_;
00072 }
|
|
|
Release lock and unblock a thread at head of queue.
Definition at line 27 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::release.
|
|
|
Explicitly destroy the mutex. Note that only one thread should call this method since it doesn't protect against race conditions. Definition at line 6 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::remove.
|
|
|
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>. Definition at line 20 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::tryacquire.
00021 {
00022 return this->lock_.tryacquire ();
00023 }
|
|
|
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 48 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::tryacquire_read.
00049 {
00050 return this->lock_.tryacquire_read ();
00051 }
|
|
|
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 55 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::tryacquire_write.
00056 {
00057 return this->lock_.tryacquire_write ();
00058 }
|
|
|
Attempt to upgrade a read lock to a write lock. Returns 0 on success, -1 on failure.
Definition at line 62 of file RW_Process_Mutex.inl. References lock_, and ACE_File_Lock::tryacquire_write_upgrade.
00063 {
00064 return this->lock_.tryacquire_write_upgrade ();
00065 }
|
|
|
Create and return the unique name.
Definition at line 17 of file RW_Process_Mutex.cpp. References ACE_UNIQUE_NAME_LEN, name_, and ACE::unique_name.
00018 {
00019 ACE::unique_name (this, this->name_, ACE_UNIQUE_NAME_LEN);
00020 return this->name_;
00021 }
|
|
|
Declare the dynamic allocation hooks.
Definition at line 95 of file RW_Process_Mutex.h. |
|
|
We need this to get the readers/writer semantics...
Definition at line 106 of file RW_Process_Mutex.h. Referenced by acquire, acquire_read, acquire_write, dump, lock, release, remove, tryacquire, tryacquire_read, tryacquire_write, and tryacquire_write_upgrade. |
|
|
If the user does not provide a name we generate a unique name in this buffer.
Definition at line 100 of file RW_Process_Mutex.h. Referenced by unique_name. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002