RW_Thread_Mutex.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //==========================================================================
00004 /**
00005  *  @file    RW_Thread_Mutex.h
00006  *
00007  *  RW_Thread_Mutex.h,v 4.2 2005/10/28 16:14:55 ossama Exp
00008  *
00009  *   Moved from Synch.h.
00010  *
00011  *  @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
00012  */
00013 //==========================================================================
00014 
00015 #ifndef ACE_RW_THREAD_MUTEX_H
00016 #define ACE_RW_THREAD_MUTEX_H
00017 #include /**/ "ace/pre.h"
00018 
00019 #include "ace/ACE_export.h"
00020 
00021 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00022 # pragma once
00023 #endif /* ACE_LACKS_PRAGMA_ONCE */
00024 
00025 #if !defined (ACE_HAS_THREADS)
00026 #  include "ace/Null_Mutex.h"
00027 #else /* ACE_HAS_THREADS */
00028 // ACE platform supports some form of threading.
00029 
00030 #include "ace/RW_Mutex.h"
00031 
00032 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00033 
00034 /**
00035  * @class ACE_RW_Thread_Mutex
00036  *
00037  * @brief Wrapper for readers/writer locks that exist within a process.
00038  */
00039 class ACE_Export ACE_RW_Thread_Mutex : public ACE_RW_Mutex
00040 {
00041 public:
00042   ACE_RW_Thread_Mutex (const ACE_TCHAR *name = 0,
00043                        void *arg = 0);
00044 
00045   /// Default dtor.
00046   ~ACE_RW_Thread_Mutex (void);
00047 
00048   /**
00049    * Conditionally upgrade a read lock to a write lock.  This only
00050    * works if there are no other readers present, in which case the
00051    * method returns 0.  Otherwise, the method returns -1 and sets
00052    * <errno> to <EBUSY>.  Note that the caller of this method *must*
00053    * already possess this lock as a read lock (but this condition is
00054    * not checked by the current implementation).
00055    */
00056   int tryacquire_write_upgrade (void);
00057 
00058   /// Dump the state of an object.
00059   void dump (void) const;
00060 
00061   /// Declare the dynamic allocation hooks.
00062   ACE_ALLOC_HOOK_DECLARE;
00063 };
00064 
00065 ACE_END_VERSIONED_NAMESPACE_DECL
00066 
00067 #if defined (__ACE_INLINE__)
00068 #include "ace/RW_Thread_Mutex.inl"
00069 #endif /* __ACE_INLINE__ */
00070 
00071 #endif /* !ACE_HAS_THREADS */
00072 
00073 #include /**/ "ace/post.h"
00074 #endif /* ACE_RW_THREAD_MUTEX_H */

Generated on Thu Nov 9 09:42:02 2006 for ACE by doxygen 1.3.6