summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-12-19 08:46:37 +0100
committerMikael Ronstrom <mikael@mysql.com>2009-12-19 08:46:37 +0100
commiteddd1a94a707f6a000b5ac24d6f6115f102804e3 (patch)
tree4e98344b28ec36f63cdd34fe65b2f166769ab5ee
parentefc20b24fc91a54d48b8194489f679cffe828666 (diff)
downloadmariadb-git-eddd1a94a707f6a000b5ac24d6f6115f102804e3.tar.gz
Make choices of atomic implementation based on highest stability
-rw-r--r--include/atomic/nolock.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/include/atomic/nolock.h b/include/atomic/nolock.h
index b2eaea34095..f1eaf8c65ab 100644
--- a/include/atomic/nolock.h
+++ b/include/atomic/nolock.h
@@ -25,17 +25,29 @@
# else
# define LOCK_prefix "lock"
# endif
-
-# ifdef HAVE_GCC_ATOMIC_BUILTINS
-# include "gcc_builtins.h"
-# elif __GNUC__
-# include "x86-gcc.h"
-# elif defined(_MSC_VER)
+/*
+ We choose implementation as follows:
+ ------------------------------------
+ On Windows using Visual C++ the native implementation should be
+ preferrable. When using gcc we prefer the native x86 implementation,
+ we prefer the Solaris implementation before the gcc because of
+ stability preference, we choose gcc implementation if nothing else
+ works on gcc. If neither Visual C++ or gcc we still choose the
+ Solaris implementation on Solaris (mainly for SunStudio compiles.
+*/
+# if defined(_MSV_VER)
# include "generic-msvc.h"
+# elif __GNUC__
+# if defined(__i386__) || defined(__x86_64__)
+# include "x86-gcc.h"
+# elif defined(HAVE_SOLARIS_ATOMIC)
+# include "solaris.h"
+# elif defined(HAVE_GCC_ATOMIC_BUILTINS)
+# include "gcc_builtins.h"
+# endif
+# elif defined(HAVE_SOLARIS_ATOMIC)
+# include "solaris.h"
# endif
-#elif defined(HAVE_SOLARIS_ATOMIC)
-#include "solaris.h"
-#endif
#if defined(make_atomic_cas_body) || defined(MY_ATOMICS_MADE)
/*