summaryrefslogtreecommitdiff
path: root/cpp/include/IceUtil/Shared.h
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2015-02-19 18:20:48 +0100
committerJose <jose@zeroc.com>2015-02-19 18:20:48 +0100
commit3368ee4416a96aea7450e3a64a1bd32bf30627ef (patch)
tree06f433bc51ba3ae235bc3b3bbc6d4c092f69c8eb /cpp/include/IceUtil/Shared.h
parentICE-6322 Network I/O on main thread (diff)
downloadice-3368ee4416a96aea7450e3a64a1bd32bf30627ef.tar.bz2
ice-3368ee4416a96aea7450e3a64a1bd32bf30627ef.tar.xz
ice-3368ee4416a96aea7450e3a64a1bd32bf30627ef.zip
Add IceUtil/Atomic.h with support for std::atomic
Diffstat (limited to 'cpp/include/IceUtil/Shared.h')
-rw-r--r--cpp/include/IceUtil/Shared.h38
1 files changed, 2 insertions, 36 deletions
diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h
index fdcbd5b29ad..1a7fe8d884e 100644
--- a/cpp/include/IceUtil/Shared.h
+++ b/cpp/include/IceUtil/Shared.h
@@ -11,32 +11,7 @@
#define ICE_UTIL_SHARED_H
#include <IceUtil/Config.h>
-
-#if defined(ICE_CPP11)
-# include <atomic>
-#elif defined(ICE_USE_MUTEX_SHARED)
-
-# include <IceUtil/Mutex.h>
-
-// Using the gcc builtins requires gcc 4.1 or better. For Linux, i386
-// doesn't work. Apple is supported for all architectures. Sun only
-// supports sparc (32 and 64 bit).
-
-#elif ((defined(__GNUC__) && (((__GNUC__* 100) + __GNUC_MINOR__) >= 401)) || __clang__) && \
- ((defined(__sun) && (defined(__sparc) || defined(__sparcv9))) || \
- defined(__APPLE__) || \
- (defined(__linux) && \
- (defined(__i486) || defined(__i586) || \
- defined(__i686) || defined(__x86_64))))
-
-# define ICE_HAS_GCC_BUILTINS
-
-#elif defined(_WIN32)
-// Nothing to include
-#else
-// Use a simple mutex
-# include <IceUtil/Mutex.h>
-#endif
+#include <IceUtil/Atomic.h>
//
// Base classes for reference counted types. The IceUtil::Handle
@@ -150,16 +125,7 @@ public:
protected:
-#if defined(ICE_CPP11)
- std::atomic<int> _ref;
-#elif defined(_WIN32)
- LONG _ref;
-#elif defined(ICE_HAS_GCC_BUILTINS)
- int _ref;
-#else
- int _ref;
- Mutex _mutex;
-#endif
+ IceUtilInternal::Atomic _ref;
unsigned char _flags;
};