diff options
author | Vasil Dimov <vasil.dimov@oracle.com> | 2010-11-26 10:54:12 +0200 |
---|---|---|
committer | Vasil Dimov <vasil.dimov@oracle.com> | 2010-11-26 10:54:12 +0200 |
commit | e2e20a04dfaff2f71ef20a8213b9d892da16b52e (patch) | |
tree | 8a02cdabf8912b42a4e3790fd4e5d920c3b9fdaf /storage | |
parent | 59e8124900a26cc87dea77c5f886d4ffcf91565e (diff) | |
download | mariadb-git-e2e20a04dfaff2f71ef20a8213b9d892da16b52e.tar.gz |
Fix the PAUSE instruction handling in InnoDB
Previously HAVE_IB_PAUSE_INSTRUCTION was never defined and thus InnoDB
never used the PAUSE instruction on non-windows even if it was available.
Probably the check was never migrated from autotools'
storage/innobase/plug.in to storage/innobase/CMakeLists.txt.
Since the check for PAUSE is done at top-level configure.cmake we can
use the result from there (HAVE_PAUSE_INSTRUCTION) instead of rolling
InnoDB's own HAVE_IB_PAUSE_INSTRUCTION (the check is identical anyway).
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/CMakeLists.txt | 2 | ||||
-rw-r--r-- | storage/innobase/include/ut0ut.h | 24 |
2 files changed, 12 insertions, 14 deletions
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 7da2bc22e39..4bbda0d2477 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -189,7 +189,7 @@ IF(SIZEOF_PTHREAD_T) ENDIF() IF(MSVC) - ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS -DHAVE_IB_PAUSE_INSTRUCTION) + ADD_DEFINITIONS(-DHAVE_WINDOWS_ATOMICS) ENDIF() diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index dd59b3eba46..5c7859a94f5 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -55,24 +55,22 @@ Created 1/20/1994 Heikki Tuuri typedef time_t ib_time_t; #ifndef UNIV_HOTBACKUP -#if defined(HAVE_IB_PAUSE_INSTRUCTION) -# ifdef WIN32 - /* In the Win32 API, the x86 PAUSE instruction is executed by calling - the YieldProcessor macro defined in WinNT.h. It is a CPU architecture- - independent way by using YieldProcessor.*/ -# define UT_RELAX_CPU() YieldProcessor() -# else - /* According to the gcc info page, asm volatile means that the - instruction has important side-effects and must not be removed. - Also asm volatile may trigger a memory barrier (spilling all registers - to memory). */ -# define UT_RELAX_CPU() __asm__ __volatile__ ("pause") -# endif +#if defined(HAVE_PAUSE_INSTRUCTION) + /* According to the gcc info page, asm volatile means that the + instruction has important side-effects and must not be removed. + Also asm volatile may trigger a memory barrier (spilling all registers + to memory). */ +# define UT_RELAX_CPU() __asm__ __volatile__ ("pause") #elif defined(HAVE_ATOMIC_BUILTINS) # define UT_RELAX_CPU() do { \ volatile lint volatile_var; \ os_compare_and_swap_lint(&volatile_var, 0, 1); \ } while (0) +#elif defined(HAVE_WINDOWS_ATOMICS) + /* In the Win32 API, the x86 PAUSE instruction is executed by calling + the YieldProcessor macro defined in WinNT.h. It is a CPU architecture- + independent way by using YieldProcessor. */ +# define UT_RELAX_CPU() YieldProcessor() #else # define UT_RELAX_CPU() ((void)0) /* avoid warning for an empty statement */ #endif |