summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2018-06-23 11:41:51 +0200
committerJohnny Willemsen <jwillemsen@remedy.nl>2018-06-23 11:41:51 +0200
commit2aeaf51d0efe793cf67281262260b906a5b0f21c (patch)
treec83cc8debbedcfbc65ccc9e7084e1c6c877e294f
parentded09ee554a5fb49fb246f9177c697fbea8c2719 (diff)
downloadATCD-2aeaf51d0efe793cf67281262260b906a5b0f21c.tar.gz
Make use of std::atomic for the refcount when we have C++11 enabled
* TAO/tao/PortableServer/Servant_Base.cpp: * TAO/tao/PortableServer/Servant_Base.h:
-rw-r--r--TAO/tao/PortableServer/Servant_Base.cpp4
-rw-r--r--TAO/tao/PortableServer/Servant_Base.h8
2 files changed, 12 insertions, 0 deletions
diff --git a/TAO/tao/PortableServer/Servant_Base.cpp b/TAO/tao/PortableServer/Servant_Base.cpp
index e0fb3cb406d..337f773f900 100644
--- a/TAO/tao/PortableServer/Servant_Base.cpp
+++ b/TAO/tao/PortableServer/Servant_Base.cpp
@@ -672,7 +672,11 @@ TAO_ServantBase::_remove_ref (void)
CORBA::ULong
TAO_ServantBase::_refcount_value (void) const
{
+#if defined (ACE_HAS_CPP11)
+ return this->ref_count_;
+#else
return this->ref_count_.value ();
+#endif /* ACE_HAS_CPP11 */
}
void
diff --git a/TAO/tao/PortableServer/Servant_Base.h b/TAO/tao/PortableServer/Servant_Base.h
index 6de277edbe6..8fe84c2cb89 100644
--- a/TAO/tao/PortableServer/Servant_Base.h
+++ b/TAO/tao/PortableServer/Servant_Base.h
@@ -22,7 +22,11 @@
#include "tao/PortableServer/PS_ForwardC.h"
#include "tao/PortableServer/Servant_var.h"
#include "tao/Abstract_Servant_Base.h"
+#if defined (ACE_HAS_CPP11)
+#include <atomic>
+#else
#include "ace/Atomic_Op.h"
+#endif /* ACE_HAS_CPP11 */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
@@ -205,7 +209,11 @@ protected:
protected:
/// Reference counter.
+#if defined (ACE_HAS_CPP11)
+ std::atomic_uint32_t ref_count_;
+#else
ACE_Atomic_Op<TAO_SYNCH_MUTEX, unsigned long> ref_count_;
+#endif /* ACE_HAS_CPP11 */
/// The operation table for this servant. It is initialized by the
/// most derived class.