summaryrefslogtreecommitdiff
path: root/include/atomic/gcc_builtins.h
diff options
context:
space:
mode:
authorMikael Ronstrom <mikael@mysql.com>2009-10-09 14:21:29 +0200
committerMikael Ronstrom <mikael@mysql.com>2009-10-09 14:21:29 +0200
commita4785fc4a2abeb3f8fbc253b78f558540b949482 (patch)
treeb01f63d310ec7286d7af99b941db923a3e02efb2 /include/atomic/gcc_builtins.h
parentee696e4163354b85c60c68cb791005fa127abcea (diff)
downloadmariadb-git-a4785fc4a2abeb3f8fbc253b78f558540b949482.tar.gz
Moved atomics from 6.0 codebase to prepare for using atomic increments in places where LOCK_thread_count previously was used
Diffstat (limited to 'include/atomic/gcc_builtins.h')
-rw-r--r--include/atomic/gcc_builtins.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/atomic/gcc_builtins.h b/include/atomic/gcc_builtins.h
index 509701b30a5..100ff80cacd 100644
--- a/include/atomic/gcc_builtins.h
+++ b/include/atomic/gcc_builtins.h
@@ -1,3 +1,6 @@
+#ifndef ATOMIC_GCC_BUILTINS_INCLUDED
+#define ATOMIC_GCC_BUILTINS_INCLUDED
+
/* Copyright (C) 2008 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -15,7 +18,7 @@
#define make_atomic_add_body(S) \
v= __sync_fetch_and_add(a, v);
-#define make_atomic_swap_body(S) \
+#define make_atomic_fas_body(S) \
v= __sync_lock_test_and_set(a, v);
#define make_atomic_cas_body(S) \
int ## S sav; \
@@ -25,9 +28,14 @@
#ifdef MY_ATOMIC_MODE_DUMMY
#define make_atomic_load_body(S) ret= *a
#define make_atomic_store_body(S) *a= v
+#define MY_ATOMIC_MODE "gcc-builtins-up"
+
#else
+#define MY_ATOMIC_MODE "gcc-builtins-smp"
#define make_atomic_load_body(S) \
ret= __sync_fetch_and_or(a, 0);
#define make_atomic_store_body(S) \
(void) __sync_lock_test_and_set(a, v);
#endif
+
+#endif /* ATOMIC_GCC_BUILTINS_INCLUDED */