Wrapper for readers/writer locks that exist across processes.
More...
#include <RW_Process_Mutex.h>
Wrapper for readers/writer locks that exist across processes.
- Note
- This class uses an ACE_File_Lock as its implementation. Thus, it can only 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.
- Todo
- For systems with pthread_rwlockattr_setpshared one may consider using them to make the mutex faster.
◆ ACE_RW_Process_Mutex()
Create a cross-process readers/writer mutex, passing in the optional name, flags and mode
- See also
- ACE_File_Lock. If not specified, a name is generated and flags and mode are set to default platform values.
◆ ~ACE_RW_Process_Mutex()
ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex |
( |
| ) |
|
◆ acquire()
int ACE_RW_Process_Mutex::acquire |
( |
| ) |
|
|
inline |
Same as acquire_write(). Acquire lock ownership; blocks until the lock is acquired or the operation fails.
◆ acquire_read()
int ACE_RW_Process_Mutex::acquire_read |
( |
| ) |
|
|
inline |
Acquire read lock; blocks until the lock is acquired or the operation fails.
◆ acquire_write()
int ACE_RW_Process_Mutex::acquire_write |
( |
| ) |
|
|
inline |
Acquire write lock; blocks until the lock is acquired or the operation fails.
◆ dump()
void ACE_RW_Process_Mutex::dump |
( |
| ) |
const |
Dump the state of an object.
◆ lock()
Return the underlying lock.
◆ release()
int ACE_RW_Process_Mutex::release |
( |
| ) |
|
|
inline |
◆ remove()
int ACE_RW_Process_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_RW_Process_Mutex::tryacquire |
( |
| ) |
|
|
inline |
Same as tryacquire_write(). Try to acquire the lock, but do not block if the lock is not immediately acquired.
- Return values
-
-1 | on failure. If the lock is already held, errno is set to EBUSY . |
◆ tryacquire_read()
int ACE_RW_Process_Mutex::tryacquire_read |
( |
| ) |
|
|
inline |
Try to acquire the read lock, but do not block if the lock is not immediately acquired.
- Return values
-
-1 | on failure. If the lock is already held, errno is set to EBUSY . |
◆ tryacquire_write()
int ACE_RW_Process_Mutex::tryacquire_write |
( |
| ) |
|
|
inline |
Try to acquire the write lock, but do not block if the lock is not immediately acquired.
- Return values
-
-1 | on failure. If the lock is already held, errno is set to EBUSY . |
◆ tryacquire_write_upgrade()
int ACE_RW_Process_Mutex::tryacquire_write_upgrade |
( |
| ) |
|
|
inline |
Attempt to upgrade a read lock to a write lock. Returns 0 on success, -1 on failure.
◆ unique_name()
const ACE_TCHAR * ACE_RW_Process_Mutex::unique_name |
( |
| ) |
|
|
private |
Create and return the unique name.
◆ ACE_ALLOC_HOOK_DECLARE
ACE_RW_Process_Mutex::ACE_ALLOC_HOOK_DECLARE |
Declare the dynamic allocation hooks.
◆ lock_
We need this to get the readers/writer semantics...
◆ name_
If the user does not provide a name we generate a unique name in this buffer.
The documentation for this class was generated from the following files: