summaryrefslogtreecommitdiff
path: root/innobase
diff options
context:
space:
mode:
authorheikki@donna.mysql.fi <>2001-05-26 21:58:59 +0300
committerheikki@donna.mysql.fi <>2001-05-26 21:58:59 +0300
commitb3675fc5f7c6036791791e3b01a0bb9e1b391fe8 (patch)
treebf62d04e36a4bbb5ec3fa445cca8e6c5ecf95f57 /innobase
parent49ac18c7c90c0a9fdff3efe50f3b94fdda4db68e (diff)
downloadmariadb-git-b3675fc5f7c6036791791e3b01a0bb9e1b391fe8.tar.gz
sync0sync.ic InnoDB now uses XCHG to implement mutex if GCC and x86
configure.in InnoDB now uses XCHG to implement mutex if GCC and x86
Diffstat (limited to 'innobase')
-rw-r--r--innobase/configure.in5
-rw-r--r--innobase/include/sync0sync.ic14
2 files changed, 19 insertions, 0 deletions
diff --git a/innobase/configure.in b/innobase/configure.in
index 83d302c6dc4..1133ab86221 100644
--- a/innobase/configure.in
+++ b/innobase/configure.in
@@ -95,6 +95,11 @@ case "$target_os" in
CFLAGS="$CFLAGS -DUNIV_MUST_NOT_INLINE";;
esac
+case "$target" in
+ i[[4567]]86-*-*)
+ CFLAGS="$CFLAGS -DUNIV_INTEL_X86";;
+esac
+
AC_OUTPUT(Makefile os/Makefile ut/Makefile btr/Makefile
buf/Makefile com/Makefile data/Makefile
dict/Makefile dyn/Makefile
diff --git a/innobase/include/sync0sync.ic b/innobase/include/sync0sync.ic
index a937ac5d579..e23e2b68e14 100644
--- a/innobase/include/sync0sync.ic
+++ b/innobase/include/sync0sync.ic
@@ -86,6 +86,20 @@ mutex_test_and_set(
/* mutex_fence(); */
return(res);
+#elif defined(__GNUC__) && defined(UNIV_INTEL_X86)
+ ulint* lw;
+ ulint res;
+
+ lw = &(mutex->lock_word);
+
+ /* In assembly we use the so-called AT & T syntax where
+ the order of operands is inverted compared to the ordinary Intel
+ syntax. The 'l' after the mnemonics denotes a 32-bit operation. */
+
+ asm volatile("movl $1, %%eax; xchgl (%%ecx), %%eax" :
+ "=eax" (res):
+ "ecx" (lw));
+ return(res);
#else
ibool ret;