summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
authorJason Evans <je@fb.com>2012-03-22 01:33:03 (GMT)
committerJason Evans <je@fb.com>2012-03-23 22:14:55 (GMT)
commitcd9a1346e96f71bdecdc654ea50fc62d76371e74 (patch)
tree1d7ed48a195ee436ebf3c2df122d85dd9d4d29dc /configure.ac
parent154829d2560a202ef6378b089655747585e44fb5 (diff)
downloadjemalloc-cd9a1346e96f71bdecdc654ea50fc62d76371e74.zip
jemalloc-cd9a1346e96f71bdecdc654ea50fc62d76371e74.tar.gz
jemalloc-cd9a1346e96f71bdecdc654ea50fc62d76371e74.tar.bz2
Implement tsd.
Implement tsd, which is a TLS/TSD abstraction that uses one or both internally. Modify bootstrapping such that no tsd's are utilized until allocation is safe. Remove malloc_[v]tprintf(), and use malloc_snprintf() instead. Fix %p argument size handling in malloc_vsnprintf(). Fix a long-standing statistics-related bug in the "thread.arena" mallctl that could cause crashes due to linked list corruption.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 02d4f53..44ff6ee 100644
--- a/configure.ac
+++ b/configure.ac
@@ -763,6 +763,20 @@ AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
CPPFLAGS="$CPPFLAGS -D_REENTRANT"
+dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
+dnl it rather than pthreads TSD cleanup functions to support cleanup during
+dnl thread exit, in order to avoid pthreads library recursion during
+dnl bootstrapping.
+force_tls="0"
+AC_CHECK_FUNC([_malloc_thread_cleanup],
+ [have__malloc_thread_cleanup="1"],
+ [have__malloc_thread_cleanup="0"]
+ )
+if test "x$have__malloc_thread_cleanup" = "x1" ; then
+ AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
+ force_tls="1"
+fi
+
dnl Disable lazy locking by default.
AC_ARG_ENABLE([lazy_lock],
[AS_HELP_STRING([--enable-lazy-lock],
@@ -795,6 +809,10 @@ fi
,
enable_tls="1"
)
+if test "x${enable_tls}" = "x0" -a "x${force_tls}" = "x1" ; then
+ AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
+ enable_tls="1"
+fi
if test "x${enable_tls}" = "x1" ; then
AC_MSG_CHECKING([for TLS])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
@@ -812,6 +830,8 @@ fi
AC_SUBST([enable_tls])
if test "x${enable_tls}" = "x1" ; then
AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
+elif test "x${force_tls}" = "x1" ; then
+ AC_MSG_ERROR([Failed to configure TLS, which is mandatory for correct function])
fi
dnl ============================================================================