summaryrefslogtreecommitdiff
path: root/storage/innobase/include
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2016-09-14 15:12:54 +0400
committerSergey Vojtovich <svoj@mariadb.org>2016-10-17 18:35:49 +0400
commit2b47f8ff03845f7ffe2fa3bd583dd4123dae2b61 (patch)
treef01e6d2c0b4f094af493d9bbc35e509de763fede /storage/innobase/include
parent5608a737ea7b5630452957b82deff4c76406041e (diff)
downloadmariadb-git-2b47f8ff03845f7ffe2fa3bd583dd4123dae2b61.tar.gz
MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes
Clean-up periodic mutex/rwlock waiters wake up. This was a hack needed to workaround broken mutexes/rwlocks implementation. We must have sane implementations now and don't need these anymore: release thread is guaranteed to wake up waiters. Removed redundant ifdef that has equivalent code in both branches. Removed os0atomic.h and os0atomic.ic: not used anymore. Clean-up unused cmake checks.
Diffstat (limited to 'storage/innobase/include')
-rw-r--r--storage/innobase/include/os0atomic.h397
-rw-r--r--storage/innobase/include/os0atomic.ic224
-rw-r--r--storage/innobase/include/os0once.h1
-rw-r--r--storage/innobase/include/sync0arr.h7
-rw-r--r--storage/innobase/include/ut0mutex.h22
-rw-r--r--storage/innobase/include/ut0ut.h4
6 files changed, 0 insertions, 655 deletions
diff --git a/storage/innobase/include/os0atomic.h b/storage/innobase/include/os0atomic.h
deleted file mode 100644
index 7ac429cfc14..00000000000
--- a/storage/innobase/include/os0atomic.h
+++ /dev/null
@@ -1,397 +0,0 @@
-/*****************************************************************************
-Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2008, Google Inc.
-
-Portions of this file contain modifications contributed and copyrighted by
-Google, Inc. Those modifications are gratefully acknowledged and are described
-briefly in the InnoDB documentation. The contributions by Google are
-incorporated with their permission, and subject to the conditions contained in
-the file COPYING.Google.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/os0atomic.h
-Macros for using atomics
-
-Created 2012-09-23 Sunny Bains (Split from os0sync.h)
-*******************************************************/
-
-#ifndef os0atomic_h
-#define os0atomic_h
-
-#include "univ.i"
-
-#ifdef _WIN32
-
-/** On Windows, InterlockedExchange operates on LONG variable */
-typedef LONG lock_word_t;
-
-#elif defined(MUTEX_FUTEX)
-
-typedef int lock_word_t;
-
-# else
-
-typedef ulint lock_word_t;
-
-#endif /* _WIN32 */
-
-#if defined __i386__ || defined __x86_64__ || defined _M_IX86 \
- || defined _M_X64 || defined __WIN__
-
-#define IB_STRONG_MEMORY_MODEL
-
-#endif /* __i386__ || __x86_64__ || _M_IX86 || _M_X64 || __WIN__ */
-
-/**********************************************************//**
-Atomic compare-and-swap and increment for InnoDB. */
-
-/** Do an atomic test and set.
-@param[in/out] ptr Memory location to set
-@param[in] new_val new value
-@return old value of memory location. */
-UNIV_INLINE
-lock_word_t
-os_atomic_test_and_set(
- volatile lock_word_t* ptr,
- lock_word_t new_val);
-
-
-/** Do an atomic compare and set
-@param[in/out] ptr Memory location to set
-@param[in] old_val old value to compare
-@param[in] new_val new value to set
-@return the value of ptr before the operation. */
-UNIV_INLINE
-lock_word_t
-os_atomic_val_compare_and_swap(
- volatile lock_word_t* ptr,
- lock_word_t old_val,
- lock_word_t new_val);
-
-#ifdef _WIN32
-
-/**********************************************************//**
-Atomic compare and exchange of signed integers (both 32 and 64 bit).
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-lint
-win_cmp_and_xchg_lint(
-/*==================*/
- volatile lint* ptr, /*!< in/out: source/destination */
- lint new_val, /*!< in: exchange value */
- lint old_val); /*!< in: value to compare to */
-
-/**********************************************************//**
-Atomic addition of signed integers.
-@return Initial value of the variable pointed to by ptr */
-UNIV_INLINE
-lint
-win_xchg_and_add(
-/*=============*/
- volatile lint* ptr, /*!< in/out: address of destination */
- lint val); /*!< in: number to be added */
-
-/**********************************************************//**
-Atomic compare and exchange of unsigned integers.
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-ulint
-win_cmp_and_xchg_ulint(
-/*===================*/
- volatile ulint* ptr, /*!< in/out: source/destination */
- ulint new_val, /*!< in: exchange value */
- ulint old_val); /*!< in: value to compare to */
-
-/**********************************************************//**
-Atomic compare and exchange of 32 bit unsigned integers.
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-DWORD
-win_cmp_and_xchg_dword(
-/*===================*/
- volatile DWORD* ptr, /*!< in/out: source/destination */
- DWORD new_val, /*!< in: exchange value */
- DWORD old_val); /*!< in: value to compare to */
-
-/**********************************************************//**
-Returns true if swapped, ptr is pointer to target, old_val is value to
-compare to, new_val is the value to swap in. */
-
-# define os_compare_and_swap_lint(ptr, old_val, new_val) \
- (win_cmp_and_xchg_lint(ptr, new_val, old_val) == old_val)
-
-# define os_compare_and_swap_ulint(ptr, old_val, new_val) \
- (win_cmp_and_xchg_ulint(ptr, new_val, old_val) == old_val)
-
-# define os_compare_and_swap_uint32(ptr, old_val, new_val) \
- (InterlockedCompareExchange(ptr, new_val, old_val) == old_val)
-
-/* windows thread objects can always be passed to windows atomic functions */
-# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
- (win_cmp_and_xchg_dword(ptr, new_val, old_val) == old_val)
-
-# define INNODB_RW_LOCKS_USE_ATOMICS
-# define IB_ATOMICS_STARTUP_MSG \
- "Mutexes and rw_locks use Windows interlocked functions"
-
-/**********************************************************//**
-Returns the resulting value, ptr is pointer to target, amount is the
-amount of increment. */
-
-# define os_atomic_increment_lint(ptr, amount) \
- (win_xchg_and_add(ptr, amount) + amount)
-
-# define os_atomic_increment_ulint(ptr, amount) \
- (static_cast<ulint>(win_xchg_and_add( \
- reinterpret_cast<volatile lint*>(ptr), \
- static_cast<lint>(amount))) \
- + static_cast<ulint>(amount))
-
-# define os_atomic_increment_uint32(ptr, amount) \
- (static_cast<ulint>(InterlockedExchangeAdd( \
- reinterpret_cast<long*>(ptr), \
- static_cast<long>(amount))) \
- + static_cast<ulint>(amount))
-
-# define os_atomic_increment_uint64(ptr, amount) \
- (static_cast<ib_uint64_t>(InterlockedExchangeAdd64( \
- reinterpret_cast<LONGLONG*>(ptr), \
- static_cast<LONGLONG>(amount))) \
- + static_cast<ib_uint64_t>(amount))
-
-/**********************************************************//**
-Returns the resulting value, ptr is pointer to target, amount is the
-amount to decrement. There is no atomic substract function on Windows */
-
-# define os_atomic_decrement_lint(ptr, amount) \
- (win_xchg_and_add(ptr, -(static_cast<lint>(amount))) - amount)
-
-# define os_atomic_decrement_ulint(ptr, amount) \
- (static_cast<ulint>(win_xchg_and_add( \
- reinterpret_cast<volatile lint*>(ptr), \
- -(static_cast<lint>(amount)))) \
- - static_cast<ulint>(amount))
-
-# define os_atomic_decrement_uint32(ptr, amount) \
- (static_cast<ib_uint32_t>(InterlockedExchangeAdd( \
- reinterpret_cast<long*>(ptr), \
- -(static_cast<long>(amount)))) \
- - static_cast<ib_uint32_t>(amount))
-
-# define os_atomic_decrement_uint64(ptr, amount) \
- (static_cast<ib_uint64_t>(InterlockedExchangeAdd64( \
- reinterpret_cast<LONGLONG*>(ptr), \
- -(static_cast<LONGLONG>(amount)))) \
- - static_cast<ib_uint64_t>(amount))
-
-#else
-/* Fall back to GCC-style atomic builtins. */
-
-/**********************************************************//**
-Returns true if swapped, ptr is pointer to target, old_val is value to
-compare to, new_val is the value to swap in. */
-
-#if defined(HAVE_GCC_SYNC_BUILTINS)
-
-# define os_compare_and_swap(ptr, old_val, new_val) \
- __sync_bool_compare_and_swap(ptr, old_val, new_val)
-
-# define os_compare_and_swap_ulint(ptr, old_val, new_val) \
- os_compare_and_swap(ptr, old_val, new_val)
-
-# define os_compare_and_swap_lint(ptr, old_val, new_val) \
- os_compare_and_swap(ptr, old_val, new_val)
-
-# define os_compare_and_swap_uint32(ptr, old_val, new_val) \
- os_compare_and_swap(ptr, old_val, new_val)
-
-#else
-
-UNIV_INLINE
-bool
-os_compare_and_swap_ulint(volatile ulint* ptr, ulint old_val, ulint new_val)
-{
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
- return __atomic_compare_exchange_n(ptr, &old_val, new_val, 0,
- __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-#else
- return __sync_bool_compare_and_swap(ptr, old_val, new_val);
-#endif
-}
-
-UNIV_INLINE
-bool
-os_compare_and_swap_lint(volatile lint* ptr, lint old_val, lint new_val)
-{
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
- return __atomic_compare_exchange_n(ptr, &old_val, new_val, 0,
- __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-#else
- return __sync_bool_compare_and_swap(ptr, old_val, new_val);
-#endif
-}
-
-UNIV_INLINE
-bool
-os_compare_and_swap_uint32(volatile ib_uint32_t* ptr, ib_uint32_t old_val, ib_uint32_t new_val)
-{
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
- return __atomic_compare_exchange_n(ptr, &old_val, new_val, 0,
- __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-#else
- return __sync_bool_compare_and_swap(ptr, old_val, new_val);
-#endif
-}
-
-#endif /* HAVE_GCC_SYNC_BUILTINS */
-
-# ifdef HAVE_IB_ATOMIC_PTHREAD_T_GCC
-#if defined(HAVE_GCC_SYNC_BUILTINS)
-# define os_compare_and_swap_thread_id(ptr, old_val, new_val) \
- os_compare_and_swap(ptr, old_val, new_val)
-#else
-UNIV_INLINE
-bool
-os_compare_and_swap_thread_id(volatile os_thread_id_t* ptr, os_thread_id_t old_val, os_thread_id_t new_val)
-{
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
- return __atomic_compare_exchange_n(ptr, &old_val, new_val, 0,
- __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-#else
- return __sync_bool_compare_and_swap(ptr, old_val, new_val);
-#endif
-}
-#endif /* HAVE_GCC_SYNC_BUILTINS */
-# define INNODB_RW_LOCKS_USE_ATOMICS
-# define IB_ATOMICS_STARTUP_MSG \
- "Mutexes and rw_locks use GCC atomic builtins"
-# else /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
-# define IB_ATOMICS_STARTUP_MSG \
- "Mutexes use GCC atomic builtins, rw_locks do not"
-# endif /* HAVE_IB_ATOMIC_PTHREAD_T_GCC */
-
-/**********************************************************//**
-Returns the resulting value, ptr is pointer to target, amount is the
-amount of increment. */
-
-#if defined(HAVE_GCC_SYNC_BUILTINS)
-# define os_atomic_increment(ptr, amount) \
- __sync_add_and_fetch(ptr, amount)
-#else
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
-# define os_atomic_increment(ptr, amount) \
- __atomic_add_fetch(ptr, amount, __ATOMIC_SEQ_CST)
-#else
-# define os_atomic_increment(ptr, amount) \
- __sync_add_and_fetch(ptr, amount)
-#endif
-
-#endif /* HAVE_GCC_SYNC_BUILTINS */
-
-# define os_atomic_increment_lint(ptr, amount) \
- os_atomic_increment(ptr, amount)
-
-# define os_atomic_increment_ulint(ptr, amount) \
- os_atomic_increment(ptr, amount)
-
-# define os_atomic_increment_uint32(ptr, amount ) \
- os_atomic_increment(ptr, amount)
-
-# define os_atomic_increment_uint64(ptr, amount) \
- os_atomic_increment(ptr, amount)
-
-/* Returns the resulting value, ptr is pointer to target, amount is the
-amount to decrement. */
-
-#if defined(HAVE_GCC_SYNC_BUILTINS)
-# define os_atomic_decrement(ptr, amount) \
- __sync_sub_and_fetch(ptr, amount)
-#else
-#ifdef HAVE_IB_GCC_ATOMIC_SEQ_CST
-# define os_atomic_decrement(ptr, amount) \
- __atomic_sub_fetch(ptr, amount, __ATOMIC_SEQ_CST)
-#else
-# define os_atomic_decrement(ptr, amount) \
- __sync_sub_and_fetch(ptr, amount)
-#endif
-#endif /* HAVE_GCC_SYNC_BUILTINS */
-
-# define os_atomic_decrement_lint(ptr, amount) \
- os_atomic_decrement(ptr, amount)
-
-# define os_atomic_decrement_ulint(ptr, amount) \
- os_atomic_decrement(ptr, amount)
-
-# define os_atomic_decrement_uint32(ptr, amount) \
- os_atomic_decrement(ptr, amount)
-
-# define os_atomic_decrement_uint64(ptr, amount) \
- os_atomic_decrement(ptr, amount)
-
-#endif
-
-#define os_atomic_inc_ulint(m,v,d) os_atomic_increment_ulint(v, d)
-#define os_atomic_dec_ulint(m,v,d) os_atomic_decrement_ulint(v, d)
-#define TAS(l, n) os_atomic_test_and_set((l), (n))
-#define CAS(l, o, n) os_atomic_val_compare_and_swap((l), (o), (n))
-
-/** barrier definitions for memory ordering */
-#ifdef HAVE_IB_GCC_ATOMIC_THREAD_FENCE
-# define HAVE_MEMORY_BARRIER
-# define os_rmb __atomic_thread_fence(__ATOMIC_ACQUIRE)
-# define os_wmb __atomic_thread_fence(__ATOMIC_RELEASE)
-# define IB_MEMORY_BARRIER_STARTUP_MSG \
- "GCC builtin __atomic_thread_fence() is used for memory barrier"
-
-#elif defined(HAVE_IB_GCC_SYNC_SYNCHRONISE)
-# define HAVE_MEMORY_BARRIER
-# define os_rmb __sync_synchronize()
-# define os_wmb __sync_synchronize()
-# define IB_MEMORY_BARRIER_STARTUP_MSG \
- "GCC builtin __sync_synchronize() is used for memory barrier"
-
-#elif defined(HAVE_IB_MACHINE_BARRIER_SOLARIS)
-# define HAVE_MEMORY_BARRIER
-# include <mbarrier.h>
-# define os_rmb __machine_r_barrier()
-# define os_wmb __machine_w_barrier()
-# define IB_MEMORY_BARRIER_STARTUP_MSG \
- "Solaris memory ordering functions are used for memory barrier"
-
-#elif defined(HAVE_WINDOWS_MM_FENCE) && defined(_WIN64)
-# define HAVE_MEMORY_BARRIER
-# include <mmintrin.h>
-# define os_rmb _mm_lfence()
-# define os_wmb _mm_sfence()
-# define IB_MEMORY_BARRIER_STARTUP_MSG \
- "_mm_lfence() and _mm_sfence() are used for memory barrier"
-
-#else
-# define os_rmb
-# define os_wmb
-# define IB_MEMORY_BARRIER_STARTUP_MSG \
- "Memory barrier is not used"
-#endif
-
-#ifndef UNIV_NONINL
-#include "os0atomic.ic"
-#endif /* UNIV_NOINL */
-
-#endif /* !os0atomic_h */
diff --git a/storage/innobase/include/os0atomic.ic b/storage/innobase/include/os0atomic.ic
deleted file mode 100644
index 1f1c460bc47..00000000000
--- a/storage/innobase/include/os0atomic.ic
+++ /dev/null
@@ -1,224 +0,0 @@
-/*****************************************************************************
-
-Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
-
-This program is free software; you can redistribute it and/or modify it under
-the terms of the GNU General Public License as published by the Free Software
-Foundation; version 2 of the License.
-
-This program is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License along with
-this program; if not, write to the Free Software Foundation, Inc.,
-51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
-
-*****************************************************************************/
-
-/**************************************************//**
-@file include/os0atomics.ic
-The interface to the operating system synchronization primitives.
-
-Created 2012-09-23 Sunny Bains (Split from include/os0sync.ic)
-*******************************************************/
-
-#ifdef _WIN32
-#include <winbase.h>
-
-/* Use inline functions to make 64 and 32 bit versions of windows atomic
-functions so that typecasts are evaluated at compile time. Take advantage
-that lint is either __int64 or long int and windows atomic functions work
-on __int64 and LONG */
-
-/**********************************************************//**
-Atomic compare and exchange of unsigned integers.
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-lint
-win_cmp_and_xchg_lint(
-/*==================*/
- volatile lint* ptr, /*!< in/out: source/destination */
- lint new_val, /*!< in: exchange value */
- lint old_val) /*!< in: value to compare to */
-{
-# ifdef _WIN64
- return(InterlockedCompareExchange64(ptr, new_val, old_val));
-# else
- return(InterlockedCompareExchange(ptr, new_val, old_val));
-# endif /* _WIN64 */
-}
-
-/**********************************************************//**
-Atomic addition of signed integers.
-@return Initial value of the variable pointed to by ptr */
-UNIV_INLINE
-lint
-win_xchg_and_add(
-/*=============*/
- volatile lint* ptr, /*!< in/out: address of destination */
- lint val) /*!< in: number to be added */
-{
-#ifdef _WIN64
- return(InterlockedExchangeAdd64(ptr, val));
-#else
- return(InterlockedExchangeAdd(ptr, val));
-#endif /* _WIN64 */
-}
-
-/**********************************************************//**
-Atomic compare and exchange of unsigned integers.
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-ulint
-win_cmp_and_xchg_ulint(
-/*===================*/
- volatile ulint* ptr, /*!< in/out: source/destination */
- ulint new_val, /*!< in: exchange value */
- ulint old_val) /*!< in: value to compare to */
-{
- return((ulint) win_cmp_and_xchg_lint(
- (volatile lint*) ptr,
- (lint) new_val,
- (lint) old_val));
-}
-
-/**********************************************************//**
-Atomic compare and exchange of 32-bit unsigned integers.
-@return value found before the exchange.
-If it is not equal to old_value the exchange did not happen. */
-UNIV_INLINE
-DWORD
-win_cmp_and_xchg_dword(
-/*===================*/
- volatile DWORD* ptr, /*!< in/out: source/destination */
- DWORD new_val, /*!< in: exchange value */
- DWORD old_val) /*!< in: value to compare to */
-{
- ut_ad(sizeof(DWORD) == sizeof(LONG)); /* We assume this. */
- return(InterlockedCompareExchange(
- (volatile LONG*) ptr,
- (LONG) new_val,
- (LONG) old_val));
-}
-
-/** Do an atomic test and set.
-@param[in,out] ptr Memory location to set
-@param[in] new_val new value
-@return old value of memory location. */
-UNIV_INLINE
-lock_word_t
-os_atomic_test_and_set(
- volatile lock_word_t* ptr,
- lock_word_t new_val)
-{
- return(InterlockedExchange(ptr, new_val));
-}
-
-/** Do an atomic compare and set
-@param[in,out] ptr Memory location to set
-@param[in] old_val old value to compare
-@param[in] new_val new value to set
-@return the value of ptr before the operation. */
-UNIV_INLINE
-lock_word_t
-os_atomic_val_compare_and_swap(
- volatile lock_word_t* ptr,
- lock_word_t old_val,
- lock_word_t new_val)
-{
- return(static_cast<lock_word_t>(win_cmp_and_xchg_lint(
- reinterpret_cast<volatile lint*>(ptr),
- static_cast<lint>(new_val),
- static_cast<lint>(old_val))));
-}
-
-#elif defined(HAVE_IB_GCC_ATOMIC_COMPARE_EXCHANGE)
-
-/** Do an atomic test and set.
-@param[in,out] ptr Memory location to set
-@param[in] new_val new value
-@return old value of memory location. */
-UNIV_INLINE
-lock_word_t
-os_atomic_test_and_set(
- volatile lock_word_t* ptr,
- lock_word_t new_val)
-{
- lock_word_t ret;
-
- /* Silence a compiler warning about unused ptr. */
- (void) ptr;
-
-#if defined(__powerpc__) || defined(__aarch64__)
- __atomic_exchange(ptr, &new_val, &ret, __ATOMIC_SEQ_CST);
-#else
- __atomic_exchange(ptr, &new_val, &ret, __ATOMIC_RELEASE);
-#endif
-
- return(ret);
-}
-
-/** Do an atomic compare and set
-@param[in,out] ptr Memory location to set
-@param[in] old_val old value to compare
-@param[in] new_val new value to set
-@return the value of ptr before the operation. */
-UNIV_INLINE
-lock_word_t
-os_atomic_val_compare_and_swap(
- volatile lock_word_t* ptr,
- lock_word_t old_val,
- lock_word_t new_val)
-{
- /* Silence a compiler warning about unused ptr. */
- (void) ptr;
-
-#if defined(__powerpc__) || defined(__aarch64__)
- __atomic_compare_exchange(ptr, &old_val, &new_val, false,
- __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
-#else
- __atomic_compare_exchange(ptr, &old_val, &new_val, false,
- __ATOMIC_RELEASE, __ATOMIC_ACQUIRE);
-#endif
-
- return(old_val);
-}
-
-#elif defined(IB_STRONG_MEMORY_MODEL)
-
-/** Do an atomic test and set.
-@param[in,out] ptr Memory location to set
-@param[in] new_val new value
-@return old value of memory location. */
-UNIV_INLINE
-lock_word_t
-os_atomic_test_and_set(
- volatile lock_word_t* ptr,
- lock_word_t new_val)
-{
- return(__sync_lock_test_and_set(ptr, new_val));
-}
-
-/** Do an atomic compare and set
-@param[in,out] ptr Memory location to set
-@param[in] old_val old value to compare
-@param[in] new_val new value to set
-@return the value of ptr before the operation. */
-UNIV_INLINE
-lock_word_t
-os_atomic_val_compare_and_swap(
- volatile lock_word_t* ptr,
- lock_word_t old_val,
- lock_word_t new_val)
-{
- return(__sync_val_compare_and_swap(ptr, old_val, new_val));
-}
-
-#else
-
-#error "Unsupported platform"
-
-#endif /* _WIN32 */
diff --git a/storage/innobase/include/os0once.h b/storage/innobase/include/os0once.h
index 38091d7bcd9..05a45a69f33 100644
--- a/storage/innobase/include/os0once.h
+++ b/storage/innobase/include/os0once.h
@@ -29,7 +29,6 @@ Created Feb 20, 2014 Vasil Dimov
#include "univ.i"
-#include "os0atomic.h"
#include "ut0ut.h"
/** Execute a given function exactly once in a multi-threaded environment
diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h
index 1a3cc93f0e9..bc419a9be8f 100644
--- a/storage/innobase/include/sync0arr.h
+++ b/storage/innobase/include/sync0arr.h
@@ -86,13 +86,6 @@ void
sync_array_object_signalled();
/**********************************************************************//**
-If the wakeup algorithm does not work perfectly at semaphore relases,
-this function will do the waking (see the comment in mutex_exit). This
-function should be called about every 1 second in the server. */
-void
-sync_arr_wake_threads_if_sema_free();
-
-/**********************************************************************//**
Prints warnings of long semaphore waits to stderr.
@return TRUE if fatal semaphore wait threshold was exceeded */
ibool
diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h
index 7622948cdc6..e4ab671eece 100644
--- a/storage/innobase/include/ut0mutex.h
+++ b/storage/innobase/include/ut0mutex.h
@@ -32,7 +32,6 @@ extern ulong srv_spin_wait_delay;
extern ulong srv_n_spin_wait_rounds;
extern ulong srv_force_recovery_crash;
-#include "os0atomic.h"
#include "sync0policy.h"
#include "ib0mutex.h"
#include <set>
@@ -45,25 +44,6 @@ extern ulong srv_force_recovery_crash;
typedef OSMutex EventMutex;
-#ifndef UNIV_DEBUG
-
-# ifdef HAVE_IB_LINUX_FUTEX
-UT_MUTEX_TYPE(TTASFutexMutex, GenericPolicy, FutexMutex);
-UT_MUTEX_TYPE(TTASFutexMutex, BlockMutexPolicy, BlockFutexMutex);
-# endif /* HAVE_IB_LINUX_FUTEX */
-
-UT_MUTEX_TYPE(TTASMutex, GenericPolicy, SpinMutex);
-UT_MUTEX_TYPE(TTASMutex, BlockMutexPolicy, BlockSpinMutex);
-
-
-UT_MUTEX_TYPE(OSTrackMutex, GenericPolicy, SysMutex);
-UT_MUTEX_TYPE(OSTrackMutex, BlockMutexPolicy, BlockSysMutex);
-
-UT_MUTEX_TYPE(TTASEventMutex, GenericPolicy, SyncArrayMutex);
-UT_MUTEX_TYPE(TTASEventMutex, BlockMutexPolicy, BlockSyncArrayMutex);
-
-#else /* !UNIV_DEBUG */
-
# ifdef HAVE_IB_LINUX_FUTEX
UT_MUTEX_TYPE(TTASFutexMutex, GenericPolicy, FutexMutex);
UT_MUTEX_TYPE(TTASFutexMutex, BlockMutexPolicy, BlockFutexMutex);
@@ -78,8 +58,6 @@ UT_MUTEX_TYPE(OSTrackMutex, BlockMutexPolicy, BlockSysMutex);
UT_MUTEX_TYPE(TTASEventMutex, GenericPolicy, SyncArrayMutex);
UT_MUTEX_TYPE(TTASEventMutex, BlockMutexPolicy, BlockSyncArrayMutex);
-#endif /* !UNIV_DEBUG */
-
#ifdef MUTEX_FUTEX
/** The default mutex type. */
typedef FutexMutex ib_mutex_t;
diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h
index 302d26a3e93..69216d213fd 100644
--- a/storage/innobase/include/ut0ut.h
+++ b/storage/innobase/include/ut0ut.h
@@ -35,10 +35,6 @@ Created 1/20/1994 Heikki Tuuri
#include "db0err.h"
-#ifndef UNIV_HOTBACKUP
-# include "os0atomic.h"
-#endif /* UNIV_HOTBACKUP */
-
#include <time.h>
#ifndef MYSQL_SERVER