mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
MDEV-21534 fixup: Remove HAVE_IB_LINUX_FUTEX
Since commit 30ea63b7d2
we actually depend on futex on Linux. Also, we depend on
std::atomic for even longer.
This commit is contained in:
parent
1e5d989d2a
commit
dcdc8c3506
3 changed files with 6 additions and 53 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue