mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 04:22:27 +01:00
MDEV-10983: TokuDB does not compile on OS X 10.12
Make use of a different function to get the current tid. Additionally, librt doesn't exist on OS X. Use System library instead.
This commit is contained in:
parent
ba11dd69fe
commit
39dceaae60
4 changed files with 20 additions and 3 deletions
|
@ -97,7 +97,7 @@ if (NOT HAVE_BACKTRACE_WITHOUT_EXECINFO)
|
|||
endif ()
|
||||
endif ()
|
||||
|
||||
if(HAVE_CLOCK_REALTIME)
|
||||
if(HAVE_CLOCK_REALTIME AND (NOT APPLE))
|
||||
list(APPEND EXTRA_SYSTEM_LIBS rt)
|
||||
else()
|
||||
list(APPEND EXTRA_SYSTEM_LIBS System)
|
||||
|
@ -109,6 +109,8 @@ check_function_exists(pthread_rwlockattr_setkind_np HAVE_PTHREAD_RWLOCKATTR_SETK
|
|||
## check for the right way to yield using pthreads
|
||||
check_function_exists(pthread_yield HAVE_PTHREAD_YIELD)
|
||||
check_function_exists(pthread_yield_np HAVE_PTHREAD_YIELD_NP)
|
||||
## check if we have pthread_threadid_np() (i.e. osx)
|
||||
check_function_exists(pthread_threadid_np HAVE_PTHREAD_THREADID_NP)
|
||||
## check if we have pthread_getthreadid_np() (i.e. freebsd)
|
||||
check_function_exists(pthread_getthreadid_np HAVE_PTHREAD_GETTHREADID_NP)
|
||||
check_function_exists(sched_getcpu HAVE_SCHED_GETCPU)
|
||||
|
|
|
@ -63,6 +63,9 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
#if defined(HAVE_SYS_SYSCTL_H)
|
||||
# include <sys/sysctl.h>
|
||||
#endif
|
||||
#if defined(HAVE_PTHREAD_H)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
#if defined(HAVE_PTHREAD_NP_H)
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
|
@ -102,7 +105,11 @@ toku_os_getpid(void) {
|
|||
|
||||
int
|
||||
toku_os_gettid(void) {
|
||||
#if defined(__NR_gettid)
|
||||
#if defined(HAVE_PTHREAD_THREADID_NP)
|
||||
uint64_t result;
|
||||
pthread_threadid_np(NULL, &result);
|
||||
return (int) result; // Used for instrumentation so overflow is ok here.
|
||||
#elif defined(__NR_gettid)
|
||||
return syscall(__NR_gettid);
|
||||
#elif defined(SYS_gettid)
|
||||
return syscall(SYS_gettid);
|
||||
|
|
|
@ -51,11 +51,18 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
#if defined(HAVE_PTHREAD_NP_H)
|
||||
# include <pthread_np.h>
|
||||
#endif
|
||||
#if defined(HAVE_PTHREAD_H)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
// since we implement the same thing here as in toku_os_gettid, this test
|
||||
// is pretty pointless
|
||||
static int gettid(void) {
|
||||
#if defined(__NR_gettid)
|
||||
#if defined(HAVE_PTHREAD_THREADID_NP)
|
||||
uint64_t result;
|
||||
pthread_threadid_np(NULL, &result);
|
||||
return (int) result;
|
||||
#elif defined(__NR_gettid)
|
||||
return syscall(__NR_gettid);
|
||||
#elif defined(SYS_gettid)
|
||||
return syscall(SYS_gettid);
|
||||
|
|
|
@ -87,6 +87,7 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
|
|||
#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_YIELD 1
|
||||
#cmakedefine HAVE_PTHREAD_YIELD_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_THREADID_NP 1
|
||||
#cmakedefine HAVE_PTHREAD_GETTHREADID_NP 1
|
||||
|
||||
#cmakedefine PTHREAD_YIELD_RETURNS_INT 1
|
||||
|
|
Loading…
Reference in a new issue