Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / RTCORBA / RT_Mutex.h
blob4e74854dc3f56bbd78f1269aeb6e86afcdc87948
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file RT_Mutex.h
7 * @author Frank Hunleth <fhunleth@cs.wustl.edu>
8 */
9 //=============================================================================
12 #ifndef TAO_RT_MUTEX_H
13 #define TAO_RT_MUTEX_H
15 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 #include "tao/RTCORBA/RTCORBA_includeC.h"
25 #include "tao/LocalObject.h"
27 #if (TAO_HAS_NAMED_RT_MUTEXES == 1)
28 # include "ace/SString.h"
29 #endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
31 #if defined(_MSC_VER)
32 #pragma warning(push)
33 #pragma warning(disable:4250)
34 #endif /* _MSC_VER */
36 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
38 /**
39 * @class TAO_RT_Mutex
41 * @brief Abstract base class for the TAO RT Mutex implementations
43 * This class just serves as a base class for any of the TAO
44 * RT Mutex implementations. Instances of these classes should
45 * be created using the RTCORBA::create_mutex() method.
48 class TAO_RTCORBA_Export TAO_RT_Mutex
49 : public RTCORBA::Mutex,
50 public ::CORBA::LocalObject
52 public:
53 /// Acquire the lock.
54 virtual void lock ();
56 /// Release the lock.
57 virtual void unlock ();
59 /**
60 * Acquire the lock, but only wait up to @a max_wait time. Note
61 * that this operation may not be available on all OS platforms, so
62 * if you're interested in writing maximally portable programs avoid
63 * using this operation in your program designs.
65 virtual CORBA::Boolean try_lock (TimeBase::TimeT max_wait);
67 /// Returns the name of the mutex.
68 virtual const char *name () const;
70 /// Destructor.
71 virtual ~TAO_RT_Mutex ();
73 protected:
74 /// Synchronization lock.
75 TAO_SYNCH_MUTEX mu_;
78 #if (TAO_HAS_NAMED_RT_MUTEXES == 1)
79 /**
80 * @class TAO_Named_RT_Mutex
82 * @brief Extension to TAO_RT_Mutex to support named mutexes.
84 class TAO_RTCORBA_Export TAO_Named_RT_Mutex : public TAO_RT_Mutex
86 public:
87 /// Constructor.
88 TAO_Named_RT_Mutex (const char *name);
90 /// Returns the name of the mutex.
91 virtual const char *name () const;
93 protected:
94 /// My name.
95 ACE_CString name_;
97 #endif /* TAO_HAS_NAMED_RT_MUTEXES == 1 */
99 TAO_END_VERSIONED_NAMESPACE_DECL
101 #if defined(_MSC_VER)
102 #pragma warning(pop)
103 #endif /* _MSC_VER */
105 #endif /* TAO_HAS_CORBA_MESSAGING && TAO_HAS_CORBA_MESSAGING != 0 */
107 #include /**/ "ace/post.h"
108 #endif /* TAO_RT_MUTEX_H */