NAME
ACE_RW_Process_Mutex - Wrapper for readers/writer locks that exist across processes.
SYNOPSIS
#include <ace/Synch.h>
class ACE_RW_Process_Mutex
{
public:
ACE_RW_Process_Mutex (
LPCTSTR name = 0,
int flags = O_CREAT|O_RDWR
);
~ACE_RW_Process_Mutex (void);
int remove (void);
int acquire (void);
int tryacquire (void);
int release (void);
int acquire_read (void);
int acquire_write (void);
int tryacquire_read (void);
int tryacquire_write (void);
const ACE_File_Lock &lock (void) const;
void dump (void) const;
ACE_ALLOC_HOOK_DECLARE;
private:
ACE_File_Lock lock_;
};
DESCRIPTION
Wrappers for various synchronization routines.
PUBLIC MEMBERS
ACE_RW_Process_Mutex (LPCTSTR name = 0, int flags = O_CREAT|O_RDWR);
Create a readers/writer Process_Mutex, passing in the optional name.
~ACE_RW_Process_Mutex (void);
int remove (void);
Explicitly destroy the mutex. Note that only one thread should call this method since it doesn't protect against race conditions.
int acquire (void);
Acquire lock ownership (wait on queue if necessary).
int 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.
int release (void);
Release lock and unblock a thread at head of queue.
int acquire_read (void);
Acquire lock ownership (wait on queue if necessary).
int acquire_write (void);
Acquire lock ownership (wait on queue if necessary).
int 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.
int 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.
const ACE_File_Lock &lock (void) const;
Return the underlying lock.
void dump (void) const;
Dump the state of an object.
ACE_ALLOC_HOOK_DECLARE;
Declare the dynamic allocation hooks.
PRIVATE MEMBERS
ACE_File_Lock lock_;
We need this to get the readers/writer semantics...
AUTHOR
Doug Schmidt
LIBRARY
ace