Changed how synchronization functions are detected

This commit is contained in:
Magne Sjaastad
2014-04-15 11:50:04 +02:00
parent 74d7ba276e
commit bf9ecc7c5f
4 changed files with 15 additions and 22 deletions

View File

@@ -141,7 +141,7 @@ int AtomicCounter::operator -- (int) // postfix
}
#elif defined(CVF_HAVE_GCC_ATOMICS)
#elif defined(CVF_GCC_DEFINED)
AtomicCounter::AtomicCounter(int initialValue)

View File

@@ -45,13 +45,8 @@
#include <libkern/OSAtomic.h>
#define CVF_ATOMIC_COUNTER_CLASS_EXISTS
#elif defined __GNUC__
#if (CVF_GCC_VER >= 40200) && (defined(__x86_64__) || defined(__i386__))
#define CVF_HAVE_GCC_ATOMICS
#define CVF_GCC_DEFINED
#define CVF_ATOMIC_COUNTER_CLASS_EXISTS
#elif (CVF_GCC_VER >= 40300)
#define CVF_HAVE_GCC_ATOMICS
#define CVF_ATOMIC_COUNTER_CLASS_EXISTS
#endif
#endif
#if defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS)

View File

@@ -43,12 +43,8 @@
#include "cvfAtomicCounter.h"
#if defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS) && defined(CVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS)
#error Two mutually exclusive defines detected : CVF_ATOMIC_COUNTER_CLASS_EXISTS && CVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS
#endif
#if !defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS) && !defined(CVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS)
#error No support for atomics. Define CVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS to be able to compile
#if !defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS) && !defined(CVF_USE_NON_THREADSAFE_REFERENCE_COUNT)
#error No support for atomics. Define CVF_USE_NON_THREADSAFE_REFERENCE_COUNT to be able to compile
#endif
namespace cvf {
@@ -75,10 +71,12 @@ public:
private:
#if defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS)
mutable AtomicCounter m_refCount;
#elif defined(CVF_WORKAROUND_TO_COMPILE_ON_SYSTEMS_WITHOUT_ATOMICS)
#if defined(CVF_USE_NON_THREADSAFE_REFERENCE_COUNT)
mutable int m_refCount;
#elif defined(CVF_ATOMIC_COUNTER_CLASS_EXISTS)
mutable AtomicCounter m_refCount;
#else
#error No support for atomics. Define CVF_USE_NON_THREADSAFE_REFERENCE_COUNT to be able to compile
#endif