correctly detect adaptive mutexes in pthreads
PTHREAD_MUTEX_ADAPTIVE_NP is an enum on glibc and not a macro, we must test for their existence by attempting compilation.
This commit is contained in:
parent
bbc5481cf9
commit
4dcf04bfc0
12
configure.ac
12
configure.ac
@ -1399,6 +1399,18 @@ if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
|
|||||||
AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
|
AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
JE_COMPILABLE([pthreads adaptive mutexes], [
|
||||||
|
#include <pthread.h>
|
||||||
|
], [
|
||||||
|
pthread_mutexattr_t attr;
|
||||||
|
pthread_mutexattr_init(&attr);
|
||||||
|
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
|
||||||
|
pthread_mutexattr_destroy(&attr);
|
||||||
|
], [je_cv_pthread_mutex_adaptive_np])
|
||||||
|
if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
|
||||||
|
AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
|
||||||
|
fi
|
||||||
|
|
||||||
dnl ============================================================================
|
dnl ============================================================================
|
||||||
dnl Check for typedefs, structures, and compiler characteristics.
|
dnl Check for typedefs, structures, and compiler characteristics.
|
||||||
AC_HEADER_STDBOOL
|
AC_HEADER_STDBOOL
|
||||||
|
@ -215,4 +215,7 @@
|
|||||||
/* glibc memalign hook */
|
/* glibc memalign hook */
|
||||||
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
|
#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
|
||||||
|
|
||||||
|
/* adaptive mutex support in pthreads */
|
||||||
|
#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
|
||||||
|
|
||||||
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
|
||||||
|
@ -10,7 +10,7 @@ typedef struct malloc_mutex_s malloc_mutex_t;
|
|||||||
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
#elif (defined(JEMALLOC_MUTEX_INIT_CB))
|
||||||
# define MALLOC_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, NULL}
|
# define MALLOC_MUTEX_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, NULL}
|
||||||
#else
|
#else
|
||||||
# if (defined(PTHREAD_MUTEX_ADAPTIVE_NP) && \
|
# if (defined(JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP) && \
|
||||||
defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP))
|
defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP))
|
||||||
# define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_ADAPTIVE_NP
|
# define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_ADAPTIVE_NP
|
||||||
# define MALLOC_MUTEX_INITIALIZER {PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP}
|
# define MALLOC_MUTEX_INITIALIZER {PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP}
|
||||||
|
Loading…
Reference in New Issue
Block a user