Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / RW_Thread_Mutex.h
blob265e4d161dcd54a62a97093443fcffc96239255f
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file RW_Thread_Mutex.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //==========================================================================
11 #ifndef ACE_RW_THREAD_MUTEX_H
12 #define ACE_RW_THREAD_MUTEX_H
13 #include /**/ "ace/pre.h"
15 #include /**/ "ace/ACE_export.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #if !defined (ACE_HAS_THREADS)
22 # include "ace/Null_Mutex.h"
23 #else /* ACE_HAS_THREADS */
24 // ACE platform supports some form of threading.
26 #include "ace/RW_Mutex.h"
28 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
30 /**
31 * @class ACE_RW_Thread_Mutex
33 * @brief Wrapper for readers/writer locks that exist within a process.
35 class ACE_Export ACE_RW_Thread_Mutex : public ACE_RW_Mutex
37 public:
38 ACE_RW_Thread_Mutex (const ACE_TCHAR *name = 0,
39 void *arg = 0);
41 /// Default dtor.
42 ~ACE_RW_Thread_Mutex ();
44 /**
45 * Conditionally upgrade a read lock to a write lock. This only
46 * works if there are no other readers present, in which case the
47 * method returns 0. Otherwise, the method returns -1 and sets
48 * @c errno to @c EBUSY. Note that the caller of this method *must*
49 * already possess this lock as a read lock (but this condition is
50 * not checked by the current implementation).
52 int tryacquire_write_upgrade ();
54 /// Dump the state of an object.
55 void dump () const;
57 /// Declare the dynamic allocation hooks.
58 ACE_ALLOC_HOOK_DECLARE;
61 ACE_END_VERSIONED_NAMESPACE_DECL
63 #if defined (__ACE_INLINE__)
64 #include "ace/RW_Thread_Mutex.inl"
65 #endif /* __ACE_INLINE__ */
67 #endif /* !ACE_HAS_THREADS */
69 #include /**/ "ace/post.h"
70 #endif /* ACE_RW_THREAD_MUTEX_H */