diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2000-11-01 22:17:39 +0000 |
commit | 53284e215e3d3351a7d7e9c4b68f14b427fb4377 (patch) | |
tree | 97236ece363cff48fd287c780db4290da39b02cb /ace/RW_Process_Mutex.h | |
parent | 7b7c52ad2abd228138ba1a948d5e28bf6dc3b880 (diff) | |
download | ATCD-53284e215e3d3351a7d7e9c4b68f14b427fb4377.tar.gz |
ChangeLogTag:Wed Nov 1 14:11:48 2000 Carlos O'Ryan <coryan@uci.edu>
Diffstat (limited to 'ace/RW_Process_Mutex.h')
-rw-r--r-- | ace/RW_Process_Mutex.h | 101 |
1 files changed, 54 insertions, 47 deletions
diff --git a/ace/RW_Process_Mutex.h b/ace/RW_Process_Mutex.h index 51e1dbf6c75..266938dab4f 100644 --- a/ace/RW_Process_Mutex.h +++ b/ace/RW_Process_Mutex.h @@ -1,18 +1,15 @@ /* -*- C++ -*- */ -// $Id$ - -// ============================================================================ -// -// = LIBRARY -// ace -// -// = FILENAME -// RW_Process_Mutex.h -// -// = AUTHOR -// Doug Schmidt -// -// ============================================================================ + +//============================================================================= +/** + * @file RW_Process_Mutex.h + * + * $Id$ + * + * @author Doug Schmidt + */ +//============================================================================= + #ifndef ACE_RW_PROCESS_MUTEX_H #define ACE_RW_PROCESS_MUTEX_H @@ -24,73 +21,83 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +/** + * @class ACE_RW_Process_Mutex + * + * @brief 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. + */ class ACE_Export ACE_RW_Process_Mutex { - // = TITLE - // Wrapper for readers/writer locks that exist across processes. - // - // = DESCRIPTION - // 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. public: + /// Create a readers/writer <Process_Mutex>, passing in the optional + /// <name>. 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>. ~ACE_RW_Process_Mutex (void); + /** + * Explicitly destroy the mutex. Note that only one thread should + * call this method since it doesn't protect against race + * conditions. + */ int remove (void); - // Explicitly destroy the mutex. Note that only one thread should - // call this method since it doesn't protect against race - // conditions. + /// Acquire lock ownership (wait on queue if necessary). int acquire (void); - // Acquire lock ownership (wait on queue if necessary). + /** + * 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 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>. + /// Release lock and unblock a thread at head of queue. int release (void); - // Release lock and unblock a thread at head of queue. + /// Acquire lock ownership (wait on queue if necessary). int acquire_read (void); - // Acquire lock ownership (wait on queue if necessary). + /// Acquire lock ownership (wait on queue if necessary). int acquire_write (void); - // Acquire lock ownership (wait on queue if necessary). + /** + * 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_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>. + /** + * 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>. + /// Attempt to upgrade a read lock to a write lock. Returns 0 on + /// success, -1 on failure. int tryacquire_write_upgrade (void); - // Attempt to upgrade a read lock to a write lock. Returns 0 on - // success, -1 on failure. + /// Return the underlying lock. const ACE_File_Lock &lock (void) const; - // Return the underlying lock. + /// Dump the state of an object. void dump (void) const; - // Dump the state of an object. + /// Declare the dynamic allocation hooks. ACE_ALLOC_HOOK_DECLARE; - // Declare the dynamic allocation hooks. private: + /// We need this to get the readers/writer semantics... ACE_File_Lock lock_; - // We need this to get the readers/writer semantics... }; #if defined (__ACE_INLINE__) |