diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-20 13:40:35 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-11-23 15:45:03 +0200 |
commit | dcdc8c3506f4da6d09e98937c299f9bf3f88a814 (patch) | |
tree | ab326ef36588371874bd84839161065fcbe8d60a | |
parent | 1e5d989d2ad9035f82853c874229e1380519daac (diff) | |
download | mariadb-git-dcdc8c3506f4da6d09e98937c299f9bf3f88a814.tar.gz |
MDEV-21534 fixup: Remove HAVE_IB_LINUX_FUTEX
Since commit 30ea63b7d2077883713e63cbf4e661ba0345bf68
we actually depend on futex on Linux. Also, we depend on
std::atomic for even longer.
-rw-r--r-- | storage/innobase/include/ib0mutex.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/ut0mutex.h | 11 | ||||
-rw-r--r-- | storage/innobase/innodb.cmake | 44 |
3 files changed, 6 insertions, 53 deletions
diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h index 91bc69ac228..81ab756665d 100644 --- a/storage/innobase/include/ib0mutex.h +++ b/storage/innobase/include/ib0mutex.h @@ -145,7 +145,7 @@ private: }; -#ifdef HAVE_IB_LINUX_FUTEX +#ifdef __linux__ #include <linux/futex.h> #include <sys/syscall.h> @@ -261,7 +261,7 @@ private: std::atomic<int32> m_lock_word; }; -#endif /* HAVE_IB_LINUX_FUTEX */ +#endif /* __linux__ */ template <template <typename> class Policy> struct TTASMutex { diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h index 294304e672a..cb43583c21d 100644 --- a/storage/innobase/include/ut0mutex.h +++ b/storage/innobase/include/ut0mutex.h @@ -24,11 +24,8 @@ Policy based mutexes. Created 2012-03-24 Sunny Bains. ***********************************************************************/ +#pragma once #ifndef UNIV_INNOCHECKSUM - -#ifndef ut0mutex_h -#define ut0mutex_h - #include "sync0policy.h" #include "ib0mutex.h" @@ -38,9 +35,9 @@ Created 2012-03-24 Sunny Bains. @param[in] T The resulting typedef alias */ #define UT_MUTEX_TYPE(M, P, T) typedef PolicyMutex<M<P> > T; -# ifdef HAVE_IB_LINUX_FUTEX +# ifdef __linux__ UT_MUTEX_TYPE(TTASFutexMutex, GenericPolicy, FutexMutex); -# endif /* HAVE_IB_LINUX_FUTEX */ +# endif /* __linux__ */ UT_MUTEX_TYPE(TTASMutex, GenericPolicy, SpinMutex); UT_MUTEX_TYPE(OSTrackMutex, GenericPolicy, SysMutex); @@ -178,6 +175,4 @@ void mutex_destroy( mutex->destroy(); } -#endif /* ut0mutex_h */ - #endif /* UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/innodb.cmake b/storage/innobase/innodb.cmake index 978b33a2abe..385e87f828e 100644 --- a/storage/innobase/innodb.cmake +++ b/storage/innobase/innodb.cmake @@ -82,8 +82,6 @@ IF(INNODB_COMPILER_HINTS) ADD_DEFINITIONS("-DCOMPILER_HINTS") ENDIF() -SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex") - # Enable InnoDB's UNIV_DEBUG in debug builds SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DUNIV_DEBUG") @@ -130,48 +128,8 @@ IF(NOT MSVC) CMAKE_C_COMPILER_VERSION VERSION_LESS "6.0.0") SET_SOURCE_FILES_PROPERTIES(trx/trx0rec.cc PROPERTIES COMPILE_FLAGS -O1) ENDIF() - -# Only use futexes on Linux if GCC atomics are available -IF(NOT MSVC AND NOT CMAKE_CROSSCOMPILING) - CHECK_C_SOURCE_RUNS( - " - #include <stdio.h> - #include <unistd.h> - #include <errno.h> - #include <assert.h> - #include <linux/futex.h> - #include <unistd.h> - #include <sys/syscall.h> - - int futex_wait(int* futex, int v) { - return(syscall(SYS_futex, futex, FUTEX_WAIT_PRIVATE, v, NULL, NULL, 0)); - } - - int futex_signal(int* futex) { - return(syscall(SYS_futex, futex, FUTEX_WAKE, 1, NULL, NULL, 0)); - } - - int main() { - int ret; - int m = 1; - - /* It is setup to fail and return EWOULDBLOCK. */ - ret = futex_wait(&m, 0); - assert(ret == -1 && errno == EWOULDBLOCK); - /* Shouldn't wake up any threads. */ - assert(futex_signal(&m) == 0); - - return(0); - }" - HAVE_IB_LINUX_FUTEX) ENDIF() -IF(HAVE_IB_LINUX_FUTEX) - ADD_DEFINITIONS(-DHAVE_IB_LINUX_FUTEX=1) -ENDIF() - -ENDIF(NOT MSVC) - CHECK_FUNCTION_EXISTS(vasprintf HAVE_VASPRINTF) CHECK_CXX_SOURCE_COMPILES("struct t1{ int a; char *b; }; struct t1 c= { .a=1, .b=0 }; main() { }" HAVE_C99_INITIALIZERS) @@ -183,7 +141,7 @@ SET(MUTEXTYPE "event" CACHE STRING "Mutex type: event, sys or futex") IF(MUTEXTYPE MATCHES "event") ADD_DEFINITIONS(-DMUTEX_EVENT) -ELSEIF(MUTEXTYPE MATCHES "futex" AND DEFINED HAVE_IB_LINUX_FUTEX) +ELSEIF(MUTEXTYPE MATCHES "futex" AND CMAKE_SYSTEM_NAME STREQUAL "Linux") ADD_DEFINITIONS(-DMUTEX_FUTEX) ELSE() ADD_DEFINITIONS(-DMUTEX_SYS) |