mirror of
https://github.com/isc-projects/bind9.git
synced 2026-03-02 05:20:33 -05: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:
parent
cb1d2e57e9
commit
01038d894f
3 changed files with 5 additions and 25 deletions
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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue