mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
Always use adaptive mutexes on Linux
When adaptive mutexes are available (with glibc), always use them. Remove the autoconf switch and also fix the static initializer.
This commit is contained in:
24
configure.ac
24
configure.ac
@@ -562,30 +562,6 @@ AC_ARG_WITH([locktype],
|
||||
(adaptive or standard)]),
|
||||
[], [with_locktype="adaptive"])
|
||||
|
||||
AS_CASE([$with_locktype],
|
||||
[adaptive],[
|
||||
AC_MSG_CHECKING([for PTHREAD_MUTEX_ADAPTIVE_NP])
|
||||
AC_COMPILE_IFELSE(
|
||||
[AC_LANG_PROGRAM(
|
||||
[[
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
]],
|
||||
[[
|
||||
return (PTHREAD_MUTEX_ADAPTIVE_NP);
|
||||
]]
|
||||
)],
|
||||
[AC_MSG_RESULT([using adaptive lock type])
|
||||
AC_DEFINE([HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], 1,
|
||||
[Support for PTHREAD_MUTEX_ADAPTIVE_NP]) ],
|
||||
[AC_MSG_RESULT([using standard lock type])]
|
||||
)],
|
||||
[standard],[AC_MSG_RESULT([using standard lock type])],
|
||||
[AC_MSG_ERROR([You must specify "adaptive" or "standard" for --with-locktype.])]
|
||||
)
|
||||
|
||||
AC_CHECK_HEADERS([sched.h])
|
||||
|
||||
AC_SEARCH_LIBS([sched_yield],[rt])
|
||||
|
@@ -23,7 +23,11 @@
|
||||
#include <isc/result.h> /* for ISC_R_ codes */
|
||||
#include <isc/util.h>
|
||||
|
||||
#if defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP)
|
||||
#define ISC_MUTEX_INITIALIZER PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
|
||||
#else
|
||||
#define ISC_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
|
||||
#endif
|
||||
|
||||
ISC_LANG_BEGINDECLS
|
||||
|
||||
|
@@ -33,7 +33,7 @@ static isc_once_t init_once = ISC_ONCE_INIT;
|
||||
static void
|
||||
mutex_initialize(void) {
|
||||
RUNTIME_CHECK(pthread_mutexattr_init(&isc__mutex_init_attr) == 0);
|
||||
#ifdef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
||||
#if defined(PTHREAD_MUTEX_ADAPTIVE_NP)
|
||||
RUNTIME_CHECK(pthread_mutexattr_settype(&isc__mutex_init_attr,
|
||||
PTHREAD_MUTEX_ADAPTIVE_NP) ==
|
||||
0);
|
||||
|
Reference in New Issue
Block a user