Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ACE_RW_Process_Mutex Class Reference

Wrapper for readers/writer locks that exist across processes. More...

#include <RW_Process_Mutex.h>

Collaboration diagram for ACE_RW_Process_Mutex:

Collaboration graph
[legend]
List of all members.

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)
 Explicitly destroy the mutex. More...

int acquire (void)
 Acquire lock ownership (wait on queue if necessary). More...

int tryacquire (void)
 Conditionally acquire lock (i.e., don't wait on queue). More...

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)
 Conditionally acquire a lock (i.e., won't block). More...

int tryacquire_write (void)
 Conditionally acquire a lock (i.e., won't block). More...

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_Locklock (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_TCHARunique_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...


Detailed Description

Wrapper for readers/writer locks that exist across processes.

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.


Constructor & Destructor Documentation

ACE_RW_Process_Mutex::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.

ACE_RW_Process_Mutex::~ACE_RW_Process_Mutex void   
 


Member Function Documentation

ACE_INLINE int ACE_RW_Process_Mutex::acquire void   
 

Acquire lock ownership (wait on queue if necessary).

ACE_INLINE int ACE_RW_Process_Mutex::acquire_read void   
 

Acquire lock ownership (wait on queue if necessary).

ACE_INLINE int ACE_RW_Process_Mutex::acquire_write void   
 

Acquire lock ownership (wait on queue if necessary).

void ACE_RW_Process_Mutex::dump void    const
 

Dump the state of an object.

ACE_INLINE const ACE_File_Lock & ACE_RW_Process_Mutex::lock void    const
 

Return the underlying lock.

ACE_INLINE int ACE_RW_Process_Mutex::release void   
 

Release lock and unblock a thread at head of queue.

ACE_INLINE int ACE_RW_Process_Mutex::remove void   
 

Explicitly destroy the mutex.

Note that only one thread should call this method since it doesn't protect against race conditions.

ACE_INLINE int ACE_RW_Process_Mutex::tryacquire void   
 

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>.

ACE_INLINE int ACE_RW_Process_Mutex::tryacquire_read void   
 

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>.

ACE_INLINE int ACE_RW_Process_Mutex::tryacquire_write void   
 

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>.

ACE_INLINE int ACE_RW_Process_Mutex::tryacquire_write_upgrade void   
 

Attempt to upgrade a read lock to a write lock. Returns 0 on success, -1 on failure.

const ACE_TCHAR * ACE_RW_Process_Mutex::unique_name void    [private]
 

Create and return the unique name.


Member Data Documentation

ACE_RW_Process_Mutex::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

ACE_File_Lock ACE_RW_Process_Mutex::lock_ [private]
 

We need this to get the readers/writer semantics...

ACE_TCHAR ACE_RW_Process_Mutex::name_[ACE_UNIQUE_NAME_LEN] [private]
 

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:
Generated on Thu May 23 00:22:10 2002 for ACE by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001