diff options
author | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-04 03:53:54 +0000 |
---|---|---|
committer | dhinton <dhinton@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2003-08-04 03:53:54 +0000 |
commit | 937a0506cb1c0980eab5bcfdf266139e1c93e80c (patch) | |
tree | 12103be26b2e9b0cd1869d7fd72a1f8a8ec362e6 /ace/RW_Thread_Mutex.h | |
parent | 868bea2cbe0807f9db59c1997ede86af27fbc8e3 (diff) | |
download | ATCD-937a0506cb1c0980eab5bcfdf266139e1c93e80c.tar.gz |
ChangeLogTag:Mon Aug 4 03:26:30 UTC 2003 Don Hinton <dhinton@dresystems.com>
Diffstat (limited to 'ace/RW_Thread_Mutex.h')
-rw-r--r-- | ace/RW_Thread_Mutex.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/ace/RW_Thread_Mutex.h b/ace/RW_Thread_Mutex.h new file mode 100644 index 00000000000..171006ad11a --- /dev/null +++ b/ace/RW_Thread_Mutex.h @@ -0,0 +1,70 @@ +// -*- C++ -*- + +//========================================================================== +/** + * @file RW_Thread_Mutex.h + * + * $Id$ + * + * Moved from Synch.h. + * + * @author Douglas C. Schmidt <schmidt@cs.wustl.edu> + */ +//========================================================================== + +#ifndef ACE_RW_THREAD_MUTEX_H +#define ACE_RW_THREAD_MUTEX_H +#include /**/ "ace/pre.h" + +#include "ace/ACE_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#if !defined (ACE_HAS_THREADS) +# include "ace/Null_Mutex.h" +#else /* ACE_HAS_THREADS */ +// ACE platform supports some form of threading. + +#include "ace/RW_Mutex.h" + +/** + * @class ACE_RW_Thread_Mutex + * + * @brief Wrapper for readers/writer locks that exist within a process. + */ +class ACE_Export ACE_RW_Thread_Mutex : public ACE_RW_Mutex +{ +public: + ACE_RW_Thread_Mutex (const ACE_TCHAR *name = 0, + void *arg = 0); + + /// Default dtor. + ~ACE_RW_Thread_Mutex (void); + + /** + * Conditionally upgrade a read lock to a write lock. This only + * works if there are no other readers present, in which case the + * method returns 0. Otherwise, the method returns -1 and sets + * <errno> to <EBUSY>. Note that the caller of this method *must* + * already possess this lock as a read lock (but this condition is + * not checked by the current implementation). + */ + int tryacquire_write_upgrade (void); + + /// Dump the state of an object. + void dump (void) const; + + /// Declare the dynamic allocation hooks. + ACE_ALLOC_HOOK_DECLARE; +}; + +#if defined (__ACE_INLINE__) +#include "ace/RW_Thread_Mutex.inl" +#endif /* __ACE_INLINE__ */ + +#endif /* !ACE_HAS_THREADS */ + +#include /**/ "ace/post.h" +#endif /* ACE_RW_THREAD_MUTEX_H */ |