summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2018-06-24 19:23:50 +0200
committerJohnny Willemsen <jwillemsen@remedy.nl>2018-06-24 19:23:50 +0200
commit36d7aee1a214c14b1621bf773e9aae82c9971af5 (patch)
tree2a049b28a7068451475a8f347e71e425bd641202
parent9d5ca158661004ec2ecabc64f2ff8297c4c2e1b4 (diff)
downloadATCD-36d7aee1a214c14b1621bf773e9aae82c9971af5.tar.gz
Make use of std::atomic when C++11 has been enabled
* TAO/tao/AnyTypeCode/Any_Impl.cpp: * TAO/tao/AnyTypeCode/Any_Impl.h: * TAO/tao/AnyTypeCode/NVList.h: * TAO/tao/AnyTypeCode/True_RefCount_Policy.h: * TAO/tao/DynamicInterface/Context.cpp: * TAO/tao/DynamicInterface/Context.h: * TAO/tao/DynamicInterface/ExceptionList.cpp: * TAO/tao/DynamicInterface/ExceptionList.h: * TAO/tao/DynamicInterface/ExceptionList.inl: * TAO/tao/DynamicInterface/Request.h: * TAO/tao/DynamicInterface/Server_Request.h: * TAO/tao/Intrusive_Ref_Count_Base_T.h: * TAO/tao/Intrusive_Ref_Count_Base_T.inl: * TAO/tao/ORB.h: * TAO/tao/ORB.inl: * TAO/tao/ORB_Core.h: * TAO/tao/ORB_Core.inl: * TAO/tao/Object.cpp: * TAO/tao/Object.h: * TAO/tao/PortableServer/Servant_Base.cpp: * TAO/tao/PortableServer/Servant_Base.h: * TAO/tao/Principal.h: * TAO/tao/Profile.h: * TAO/tao/Refcounted_ObjectKey.cpp: * TAO/tao/Refcounted_ObjectKey.h: * TAO/tao/Refcounted_ObjectKey.inl: * TAO/tao/Reply_Dispatcher.cpp: * TAO/tao/Reply_Dispatcher.h: * TAO/tao/Stub.h: * TAO/tao/Valuetype/AbstractBase.h: * TAO/tao/Valuetype/ValueBase.cpp: * TAO/tao/Valuetype/ValueBase.h: * TAO/tao/Valuetype/ValueFactory.cpp: * TAO/tao/Valuetype/ValueFactory.h:
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl.cpp2
-rw-r--r--TAO/tao/AnyTypeCode/Any_Impl.h20
-rw-r--r--TAO/tao/AnyTypeCode/NVList.h15
-rw-r--r--TAO/tao/AnyTypeCode/True_RefCount_Policy.h10
-rw-r--r--TAO/tao/DynamicInterface/Context.cpp12
-rw-r--r--TAO/tao/DynamicInterface/Context.h19
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.cpp6
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.h13
-rw-r--r--TAO/tao/DynamicInterface/ExceptionList.inl2
-rw-r--r--TAO/tao/DynamicInterface/Request.h10
-rw-r--r--TAO/tao/DynamicInterface/Server_Request.h10
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Base_T.h14
-rw-r--r--TAO/tao/Intrusive_Ref_Count_Base_T.inl6
-rw-r--r--TAO/tao/ORB.h10
-rw-r--r--TAO/tao/ORB.inl4
-rw-r--r--TAO/tao/ORB_Core.h10
-rw-r--r--TAO/tao/ORB_Core.inl4
-rw-r--r--TAO/tao/Object.cpp6
-rw-r--r--TAO/tao/Object.h10
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp12
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h4
-rw-r--r--TAO/tao/Principal.h11
-rw-r--r--TAO/tao/Profile.h12
-rw-r--r--TAO/tao/Refcounted_ObjectKey.cpp2
-rw-r--r--TAO/tao/Refcounted_ObjectKey.h2
-rw-r--r--TAO/tao/Refcounted_ObjectKey.inl8
-rw-r--r--TAO/tao/Reply_Dispatcher.cpp6
-rw-r--r--TAO/tao/Reply_Dispatcher.h2
-rw-r--r--TAO/tao/Stub.h11
-rw-r--r--TAO/tao/Valuetype/AbstractBase.h9
-rw-r--r--TAO/tao/Valuetype/ValueBase.cpp6
-rw-r--r--TAO/tao/Valuetype/ValueBase.h12
-rw-r--r--TAO/tao/Valuetype/ValueFactory.cpp6
-rw-r--r--TAO/tao/Valuetype/ValueFactory.h12
34 files changed, 226 insertions, 72 deletions
diff --git a/TAO/tao/AnyTypeCode/Any_Impl.cpp b/TAO/tao/AnyTypeCode/Any_Impl.cpp
index 4655db276f9..3633d68739f 100644
--- a/TAO/tao/AnyTypeCode/Any_Impl.cpp
+++ b/TAO/tao/AnyTypeCode/Any_Impl.cpp
@@ -110,7 +110,7 @@ TAO::Any_Impl::_add_ref (void)
void
TAO::Any_Impl::_remove_ref (void)
{
- const CORBA::ULong new_count = --this->refcount_;
+ CORBA::ULong const new_count = --this->refcount_;
if (new_count != 0)
return;
diff --git a/TAO/tao/AnyTypeCode/Any_Impl.h b/TAO/tao/AnyTypeCode/Any_Impl.h
index 57e304288e1..2446ec37368 100644
--- a/TAO/tao/AnyTypeCode/Any_Impl.h
+++ b/TAO/tao/AnyTypeCode/Any_Impl.h
@@ -23,14 +23,14 @@
#include "tao/AnyTypeCode/TAO_AnyTypeCode_Export.h"
#include "tao/Basic_Types.h"
-#include "ace/Synch_Traits.h"
-#include "ace/Null_Mutex.h"
-#include "ace/Thread_Mutex.h"
-#include "ace/Atomic_Op.h"
-
-ACE_BEGIN_VERSIONED_NAMESPACE_DECL
-class ACE_Message_Block;
-ACE_END_VERSIONED_NAMESPACE_DECL
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Synch_Traits.h"
+# include "ace/Null_Mutex.h"
+# include "ace/Thread_Mutex.h"
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -104,7 +104,11 @@ namespace TAO
private:
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
};
}
diff --git a/TAO/tao/AnyTypeCode/NVList.h b/TAO/tao/AnyTypeCode/NVList.h
index 24aa3a9498d..e68f65402bf 100644
--- a/TAO/tao/AnyTypeCode/NVList.h
+++ b/TAO/tao/AnyTypeCode/NVList.h
@@ -26,8 +26,11 @@
#include "ace/Unbounded_Queue.h"
#include "ace/Thread_Mutex.h"
-#include "ace/Atomic_Op.h"
-
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -120,7 +123,11 @@ namespace CORBA
private:
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// holds the value
Any any_;
@@ -263,7 +270,11 @@ namespace CORBA
ULong max_;
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Protects the incoming pointer.
TAO_SYNCH_MUTEX lock_;
diff --git a/TAO/tao/AnyTypeCode/True_RefCount_Policy.h b/TAO/tao/AnyTypeCode/True_RefCount_Policy.h
index a4c96d3d7d7..0f5a0875873 100644
--- a/TAO/tao/AnyTypeCode/True_RefCount_Policy.h
+++ b/TAO/tao/AnyTypeCode/True_RefCount_Policy.h
@@ -25,7 +25,11 @@
#include "tao/orbconf.h"
#include "ace/Thread_Mutex.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -101,7 +105,11 @@ namespace TAO
private:
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
};
} // End namespace TAO
diff --git a/TAO/tao/DynamicInterface/Context.cpp b/TAO/tao/DynamicInterface/Context.cpp
index 01cb4234dbb..92f4a4a6161 100644
--- a/TAO/tao/DynamicInterface/Context.cpp
+++ b/TAO/tao/DynamicInterface/Context.cpp
@@ -84,7 +84,7 @@ CORBA::Context::get_values (const char * /* start_scope */,
}
CORBA::ContextList::ContextList (CORBA::ULong len, char* *ctx_list)
- : ref_count_ (1)
+ : refcount_ (1)
{
for (CORBA::ULong i=0; i < len; i++)
{
@@ -143,14 +143,14 @@ CORBA::ContextList::remove (CORBA::ULong)
CORBA::ContextList_ptr
CORBA::ContextList::_duplicate (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
return this;
}
void
CORBA::ContextList::_destroy (void)
{
- CORBA::ULong const current = --this->ref_count_;
+ CORBA::ULong const current = --this->refcount_;
if (current == 0)
{
@@ -161,15 +161,15 @@ CORBA::ContextList::_destroy (void)
void
CORBA::ContextList::_incr_refcount (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
}
void
CORBA::ContextList::_decr_refcount (void)
{
- --this->ref_count_;
+ --this->refcount_;
- if (this->ref_count_ != 0)
+ if (this->refcount_ != 0)
{
delete this;
}
diff --git a/TAO/tao/DynamicInterface/Context.h b/TAO/tao/DynamicInterface/Context.h
index a20b50554c4..30c269457a0 100644
--- a/TAO/tao/DynamicInterface/Context.h
+++ b/TAO/tao/DynamicInterface/Context.h
@@ -31,8 +31,11 @@
#include "tao/default_environment.h"
#include "ace/Unbounded_Queue.h"
-#include "ace/Atomic_Op.h"
-#include "ace/Synch_Traits.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -111,7 +114,11 @@ namespace CORBA
private:
/// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> refcount_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
};
/**
@@ -176,7 +183,11 @@ namespace CORBA
ContextList &operator= (const ContextList &);
/// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Internal list of typecodes.
ACE_Unbounded_Queue<char *> ctx_list_;
diff --git a/TAO/tao/DynamicInterface/ExceptionList.cpp b/TAO/tao/DynamicInterface/ExceptionList.cpp
index 5fb4d67b4a0..40a06e0ded3 100644
--- a/TAO/tao/DynamicInterface/ExceptionList.cpp
+++ b/TAO/tao/DynamicInterface/ExceptionList.cpp
@@ -10,7 +10,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
CORBA::ExceptionList::ExceptionList (CORBA::ULong len,
CORBA::TypeCode_ptr *tc_list)
- : ref_count_ (1)
+ : refcount_ (1)
{
for (CORBA::ULong i = 0; i < len; ++i)
{
@@ -82,13 +82,13 @@ CORBA::ExceptionList::_destroy (void)
void
CORBA::ExceptionList::_incr_refcount (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
}
void
CORBA::ExceptionList::_decr_refcount (void)
{
- CORBA::ULong const refcount = --this->ref_count_;
+ CORBA::ULong const refcount = --this->refcount_;
if (refcount == 0)
{
diff --git a/TAO/tao/DynamicInterface/ExceptionList.h b/TAO/tao/DynamicInterface/ExceptionList.h
index ab040f80b7d..cf4008f0f6c 100644
--- a/TAO/tao/DynamicInterface/ExceptionList.h
+++ b/TAO/tao/DynamicInterface/ExceptionList.h
@@ -30,8 +30,11 @@
#include "tao/Pseudo_VarOut_T.h"
#include "ace/Unbounded_Queue.h"
-#include "ace/Atomic_Op.h"
-#include "ace/Synch_Traits.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -105,7 +108,11 @@ namespace CORBA
ExceptionList &operator= (const ExceptionList &);
/// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> ref_count_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Internal list of typecodes.
ACE_Unbounded_Queue<CORBA::TypeCode_ptr> tc_list_;
diff --git a/TAO/tao/DynamicInterface/ExceptionList.inl b/TAO/tao/DynamicInterface/ExceptionList.inl
index 21c37cc3898..4178f77d903 100644
--- a/TAO/tao/DynamicInterface/ExceptionList.inl
+++ b/TAO/tao/DynamicInterface/ExceptionList.inl
@@ -3,7 +3,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE
CORBA::ExceptionList::ExceptionList (void)
- : ref_count_ (1)
+ : refcount_ (1)
{
}
diff --git a/TAO/tao/DynamicInterface/Request.h b/TAO/tao/DynamicInterface/Request.h
index 997309f279a..0560d577255 100644
--- a/TAO/tao/DynamicInterface/Request.h
+++ b/TAO/tao/DynamicInterface/Request.h
@@ -40,7 +40,11 @@
#endif /* TAO_HAS_AMI */
#include "ace/SString.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -246,7 +250,11 @@ namespace CORBA
CORBA::Context_ptr ctx_;
/// Reference counting.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Protect the response_received_.
TAO_SYNCH_MUTEX lock_;
diff --git a/TAO/tao/DynamicInterface/Server_Request.h b/TAO/tao/DynamicInterface/Server_Request.h
index 532e8498e3a..555e1c4f8f7 100644
--- a/TAO/tao/DynamicInterface/Server_Request.h
+++ b/TAO/tao/DynamicInterface/Server_Request.h
@@ -29,7 +29,11 @@
#include "tao/TAO_Server_Request.h"
#include "tao/CDR.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -146,7 +150,11 @@ namespace CORBA
CORBA::Any_ptr exception_;
/// Reference counting.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Request from the ORB.
TAO_ServerRequest &orb_server_request_;
diff --git a/TAO/tao/Intrusive_Ref_Count_Base_T.h b/TAO/tao/Intrusive_Ref_Count_Base_T.h
index ae30d217e4e..c4c6f181b75 100644
--- a/TAO/tao/Intrusive_Ref_Count_Base_T.h
+++ b/TAO/tao/Intrusive_Ref_Count_Base_T.h
@@ -19,7 +19,13 @@
#include /**/ "tao/Versioned_Namespace.h"
-#include "ace/Atomic_Op.h"
+#include "tao/Basic_Types.h"
+
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -46,7 +52,11 @@ protected:
TAO_Intrusive_Ref_Count_Base (void);
private:
- ACE_Atomic_Op<ACE_LOCK, long> ref_count_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<ACE_LOCK, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
// Prevent copying/assignment.
TAO_Intrusive_Ref_Count_Base (const TAO_Intrusive_Ref_Count_Base&);
diff --git a/TAO/tao/Intrusive_Ref_Count_Base_T.inl b/TAO/tao/Intrusive_Ref_Count_Base_T.inl
index 158af586e62..336e713d1d7 100644
--- a/TAO/tao/Intrusive_Ref_Count_Base_T.inl
+++ b/TAO/tao/Intrusive_Ref_Count_Base_T.inl
@@ -4,7 +4,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
template <typename T>
ACE_INLINE
TAO_Intrusive_Ref_Count_Base<T>::TAO_Intrusive_Ref_Count_Base (void)
- : ref_count_(1)
+ : refcount_(1)
{}
@@ -13,7 +13,7 @@ ACE_INLINE
void
TAO_Intrusive_Ref_Count_Base<T>::_add_ref (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
}
@@ -22,7 +22,7 @@ ACE_INLINE
void
TAO_Intrusive_Ref_Count_Base<T>::_remove_ref (void)
{
- long const new_count = --this->ref_count_;
+ CORBA::ULong const new_count = --this->refcount_;
if (new_count != 0)
{
diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h
index 6d936dfb818..083da7de8d7 100644
--- a/TAO/tao/ORB.h
+++ b/TAO/tao/ORB.h
@@ -35,7 +35,11 @@
#include "ace/Thread_Mutex.h"
#include "ace/Guard_T.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -577,7 +581,11 @@ namespace CORBA
/// Maintains a reference count of number of instantiations of the
/// ORB.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// The ORB_Core that created us....
TAO_ORB_Core * orb_core_;
diff --git a/TAO/tao/ORB.inl b/TAO/tao/ORB.inl
index 9772329fbec..b46a2f83819 100644
--- a/TAO/tao/ORB.inl
+++ b/TAO/tao/ORB.inl
@@ -26,7 +26,11 @@ CORBA::ORB::_incr_refcount (void)
ACE_INLINE unsigned long
CORBA::ORB::_refcount (void) const
{
+#if defined (ACE_HAS_CPP11)
+ return this->refcount_;
+#else
return this->refcount_.value ();
+#endif /* ACE_HAS_CPP11 */
}
ACE_INLINE unsigned long
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index 29ee9d89f2e..f29cd02430d 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -40,8 +40,12 @@
#include "ace/Thread_Manager.h"
#include "ace/Lock_Adapter_T.h"
#include "ace/TSS_T.h"
-
#include "ace/Service_Config.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Data_Block;
@@ -1207,7 +1211,11 @@ protected:
#endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */
/// Number of outstanding references to this object.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// Registry containing all registered policy factories.
TAO::PolicyFactory_Registry_Adapter *policy_factory_registry_;
diff --git a/TAO/tao/ORB_Core.inl b/TAO/tao/ORB_Core.inl
index be5af02ee10..f68d3beef3d 100644
--- a/TAO/tao/ORB_Core.inl
+++ b/TAO/tao/ORB_Core.inl
@@ -19,7 +19,11 @@ TAO_ORB_Core::_incr_refcnt (void)
ACE_INLINE unsigned long
TAO_ORB_Core::_refcnt (void) const
{
+#if defined (ACE_HAS_CPP11)
+ return this->refcount_;
+#else
return this->refcount_.value ();
+#endif /* ACE_HAS_CPP11 */
}
ACE_INLINE unsigned long
diff --git a/TAO/tao/Object.cpp b/TAO/tao/Object.cpp
index 78a7cd0d77c..b96ae7b5125 100644
--- a/TAO/tao/Object.cpp
+++ b/TAO/tao/Object.cpp
@@ -110,7 +110,11 @@ CORBA::Object::_remove_ref (void)
CORBA::ULong
CORBA::Object::_refcount_value(void) const
{
- return static_cast<CORBA::ULong> (this->refcount_.value ());
+#if defined (ACE_HAS_CPP11)
+ return this->refcount_;
+#else
+ return this->refcount_.value ();
+#endif /* ACE_HAS_CPP11 */
}
void
diff --git a/TAO/tao/Object.h b/TAO/tao/Object.h
index 8b401aab505..680428190b5 100644
--- a/TAO/tao/Object.h
+++ b/TAO/tao/Object.h
@@ -30,7 +30,11 @@
#include "tao/Object_Argument_T.h"
#include "tao/Arg_Traits_T.h"
#include "tao/Any_Insert_Policy_T.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
#if defined (HPUX) && defined (IOR)
/* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
@@ -340,7 +344,11 @@ namespace CORBA
TAO::Object_Proxy_Broker *proxy_broker () const;
/// Number of outstanding references to this object.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
private:
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
index 337f773f900..704260f8cac 100644
--- a/TAO/tao/PortableServer/Servant_Base.cpp
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -59,14 +59,14 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_ServantBase::TAO_ServantBase (TAO_Operation_Table* optable)
: TAO_Abstract_ServantBase ()
- , ref_count_ (1)
+ , refcount_ (1)
, optable_ (optable)
{
}
TAO_ServantBase::TAO_ServantBase (const TAO_ServantBase &rhs)
: TAO_Abstract_ServantBase ()
- , ref_count_ (1)
+ , refcount_ (1)
, optable_ (rhs.optable_)
{
}
@@ -655,13 +655,13 @@ TAO_ServantBase::asynchronous_upcall_dispatch (
void
TAO_ServantBase::_add_ref (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
}
void
TAO_ServantBase::_remove_ref (void)
{
- unsigned long const new_count = --this->ref_count_;
+ CORBA::ULong const new_count = --this->refcount_;
if (new_count == 0)
{
@@ -673,9 +673,9 @@ CORBA::ULong
TAO_ServantBase::_refcount_value (void) const
{
#if defined (ACE_HAS_CPP11)
- return this->ref_count_;
+ return this->refcount_;
#else
- return this->ref_count_.value ();
+ return this->refcount_.value ();
#endif /* ACE_HAS_CPP11 */
}
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
index b37018662db..603a33e1328 100644
--- a/TAO/tao/PortableServer/Servant_Base.h
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -210,9 +210,9 @@ protected:
protected:
/// Reference counter.
#if defined (ACE_HAS_CPP11)
- std::atomic<uint32_t> ref_count_;
+ std::atomic<uint32_t> refcount_;
#else
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> ref_count_;
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
#endif /* ACE_HAS_CPP11 */
/// The operation table for this servant. It is initialized by the
diff --git a/TAO/tao/Principal.h b/TAO/tao/Principal.h
index a59912b817e..e961e8b419a 100644
--- a/TAO/tao/Principal.h
+++ b/TAO/tao/Principal.h
@@ -24,9 +24,12 @@
#include "tao/OctetSeqC.h"
#include "tao/Pseudo_VarOut_T.h"
-
#include "ace/Thread_Mutex.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -91,7 +94,11 @@ namespace CORBA
private:
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
};
} // End CORBA namespace
diff --git a/TAO/tao/Profile.h b/TAO/tao/Profile.h
index ce7505009ce..88423d1657e 100644
--- a/TAO/tao/Profile.h
+++ b/TAO/tao/Profile.h
@@ -22,7 +22,11 @@
#include "tao/GIOP_Message_Version.h"
#include "tao/Refcounted_ObjectKey.h"
#include "tao/Service_Callbacks.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_Lock;
@@ -380,7 +384,11 @@ private:
TAO_MProfile* forward_to_;
/// Number of outstanding references to this object.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// A lock that protects creation of the tagged profile
TAO_SYNCH_MUTEX tagged_profile_lock_;
diff --git a/TAO/tao/Refcounted_ObjectKey.cpp b/TAO/tao/Refcounted_ObjectKey.cpp
index 5c87170bbbc..4290884211a 100644
--- a/TAO/tao/Refcounted_ObjectKey.cpp
+++ b/TAO/tao/Refcounted_ObjectKey.cpp
@@ -10,7 +10,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO::Refcounted_ObjectKey::Refcounted_ObjectKey (const TAO::ObjectKey &key)
: object_key_ (key)
- , ref_count_ (1)
+ , refcount_ (1)
{
}
diff --git a/TAO/tao/Refcounted_ObjectKey.h b/TAO/tao/Refcounted_ObjectKey.h
index 4a8dd4c0a46..96142a512d6 100644
--- a/TAO/tao/Refcounted_ObjectKey.h
+++ b/TAO/tao/Refcounted_ObjectKey.h
@@ -62,7 +62,7 @@ namespace TAO
ObjectKey object_key_;
/// The refcount on the object key..
- CORBA::ULong ref_count_;
+ CORBA::ULong refcount_;
};
}
diff --git a/TAO/tao/Refcounted_ObjectKey.inl b/TAO/tao/Refcounted_ObjectKey.inl
index eaef9e967cd..35fa18b2ea3 100644
--- a/TAO/tao/Refcounted_ObjectKey.inl
+++ b/TAO/tao/Refcounted_ObjectKey.inl
@@ -4,7 +4,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE void
TAO::Refcounted_ObjectKey::incr_refcount (void)
{
- ++this->ref_count_;
+ ++this->refcount_;
}
ACE_INLINE const TAO::ObjectKey &
@@ -16,12 +16,12 @@ TAO::Refcounted_ObjectKey::object_key (void) const
ACE_INLINE CORBA::ULong
TAO::Refcounted_ObjectKey::decr_refcount (void)
{
- if (--this->ref_count_ > 0)
+ if (--this->refcount_ > 0)
{
- return this->ref_count_;
+ return this->refcount_;
}
- ACE_ASSERT (this->ref_count_ == 0);
+ ACE_ASSERT (this->refcount_ == 0);
delete this;
diff --git a/TAO/tao/Reply_Dispatcher.cpp b/TAO/tao/Reply_Dispatcher.cpp
index a2ebe2f4838..620f87f65e2 100644
--- a/TAO/tao/Reply_Dispatcher.cpp
+++ b/TAO/tao/Reply_Dispatcher.cpp
@@ -11,7 +11,7 @@ TAO_Reply_Dispatcher::TAO_Reply_Dispatcher (ACE_Allocator *allocator)
// Just an invalid reply status.
: locate_reply_status_ (GIOP::UNKNOWN_OBJECT)
, reply_status_ (GIOP::NO_EXCEPTION)
- , refcnt_ (1)
+ , refcount_ (1)
, allocator_(allocator)
{
}
@@ -27,7 +27,7 @@ TAO_Reply_Dispatcher::intrusive_add_ref (TAO_Reply_Dispatcher* rd)
{
if (rd != 0)
{
- ++rd->refcnt_;
+ ++rd->refcount_;
}
}
@@ -36,7 +36,7 @@ TAO_Reply_Dispatcher::intrusive_remove_ref (TAO_Reply_Dispatcher* rd)
{
if (rd != 0)
{
- long tmp = --rd->refcnt_;
+ long const tmp = --rd->refcount_;
if (tmp <= 0)
{
if (rd->allocator_)
diff --git a/TAO/tao/Reply_Dispatcher.h b/TAO/tao/Reply_Dispatcher.h
index b01c69d657e..949bf0dfccd 100644
--- a/TAO/tao/Reply_Dispatcher.h
+++ b/TAO/tao/Reply_Dispatcher.h
@@ -103,7 +103,7 @@ protected:
private:
/// Support for intrusive reference counting
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> refcnt_;
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> refcount_;
/// Allocator that was used to allocate this reply dispatcher. In case of
/// zero we come from the heap.
diff --git a/TAO/tao/Stub.h b/TAO/tao/Stub.h
index 792cecaaf79..9b1764436e1 100644
--- a/TAO/tao/Stub.h
+++ b/TAO/tao/Stub.h
@@ -22,8 +22,11 @@
#include "tao/MProfile.h"
#include "tao/ORB_Core_Auto_Ptr.h"
-
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
#if defined (HPUX) && defined (IOR)
/* HP-UX 11.11 defines IOR in /usr/include/pa/inline.h
@@ -381,7 +384,11 @@ protected:
CORBA::Boolean profile_success_;
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
/// The policy overrides in this object, if nil then use the default
/// policies.
diff --git a/TAO/tao/Valuetype/AbstractBase.h b/TAO/tao/Valuetype/AbstractBase.h
index da23142d059..d23b249e062 100644
--- a/TAO/tao/Valuetype/AbstractBase.h
+++ b/TAO/tao/Valuetype/AbstractBase.h
@@ -25,6 +25,11 @@
#include "tao/Objref_VarOut_T.h"
#include "tao/Object.h" /* For CORBA::Object_var */
#include "tao/Pseudo_VarOut_T.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -143,7 +148,11 @@ namespace CORBA
private:
/// Number of outstanding references to this object.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
CORBA::Boolean is_collocated_;
TAO_Abstract_ServantBase *servant_;
diff --git a/TAO/tao/Valuetype/ValueBase.cpp b/TAO/tao/Valuetype/ValueBase.cpp
index 9fc61b1b0c3..dd0a46c847e 100644
--- a/TAO/tao/Valuetype/ValueBase.cpp
+++ b/TAO/tao/Valuetype/ValueBase.cpp
@@ -1426,9 +1426,13 @@ CORBA::DefaultValueRefCountBase::_tao_remove_ref (void)
}
CORBA::ULong
-CORBA::DefaultValueRefCountBase::_tao_refcount_value (void)
+CORBA::DefaultValueRefCountBase::_tao_refcount_value (void) const
{
+#if defined (ACE_HAS_CPP11)
+ return this->refcount_;
+#else
return this->refcount_.value ();
+#endif /* ACE_HAS_CPP11 */
}
// ===========================================================
diff --git a/TAO/tao/Valuetype/ValueBase.h b/TAO/tao/Valuetype/ValueBase.h
index 7eb6e378259..25a68b6e00a 100644
--- a/TAO/tao/Valuetype/ValueBase.h
+++ b/TAO/tao/Valuetype/ValueBase.h
@@ -30,7 +30,11 @@
#include "ace/Basic_Types.h"
#include "ace/Synch_Traits.h"
#include "ace/Thread_Mutex.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
#include "ace/Null_Mutex.h"
#include "ace/Vector_T.h"
@@ -331,7 +335,7 @@ namespace CORBA
/// (if valuetype T is compiled with optimization for that.) %! (todo)
void _tao_add_ref (void);
void _tao_remove_ref (void);
- CORBA::ULong _tao_refcount_value (void);
+ CORBA::ULong _tao_refcount_value (void) const;
protected:
DefaultValueRefCountBase (void);
@@ -343,7 +347,11 @@ namespace CORBA
private: // data
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
}; // DefaultValueRefCountBase
// which lock has the lowest memory overhead ?
diff --git a/TAO/tao/Valuetype/ValueFactory.cpp b/TAO/tao/Valuetype/ValueFactory.cpp
index d65e09ed1c0..ad7003800d2 100644
--- a/TAO/tao/Valuetype/ValueFactory.cpp
+++ b/TAO/tao/Valuetype/ValueFactory.cpp
@@ -27,7 +27,7 @@ CORBA::remove_ref (CORBA::ValueFactoryBase *val)
// ===========================================================
CORBA::ValueFactoryBase::ValueFactoryBase (void)
- : _tao_reference_count_ (1)
+ : refcount_ (1)
{
}
@@ -38,13 +38,13 @@ CORBA::ValueFactoryBase::~ValueFactoryBase (void)
void
CORBA::ValueFactoryBase::_add_ref (void)
{
- ++this->_tao_reference_count_;
+ ++this->refcount_;
}
void
CORBA::ValueFactoryBase::_remove_ref (void)
{
- CORBA::ULong const new_count = --this->_tao_reference_count_;
+ CORBA::ULong const new_count = --this->refcount_;
if (new_count == 0)
delete this;
diff --git a/TAO/tao/Valuetype/ValueFactory.h b/TAO/tao/Valuetype/ValueFactory.h
index 7f18962a74b..6003f803086 100644
--- a/TAO/tao/Valuetype/ValueFactory.h
+++ b/TAO/tao/Valuetype/ValueFactory.h
@@ -26,7 +26,11 @@
#include "ace/Synch_Traits.h"
#include "ace/Thread_Mutex.h"
#include "ace/Null_Mutex.h"
-#include "ace/Atomic_Op.h"
+#if defined (ACE_HAS_CPP11)
+# include <atomic>
+#else
+# include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -68,7 +72,11 @@ namespace CORBA
private:
/// Reference counter.
- ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> _tao_reference_count_;
+#if defined (ACE_HAS_CPP11)
+ std::atomic<uint32_t> refcount_;
+#else
+ ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> refcount_;
+#endif /* ACE_HAS_CPP11 */
};
} // End CORBA namespace