mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
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).
This commit is contained in:
parent
59e8124900
commit
e2e20a04df
2 changed files with 12 additions and 14 deletions
|
@ -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()
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
#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")
|
||||
# endif
|
||||
#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
|
||||
|
|
Loading…
Reference in a new issue