diff --git a/libc/Android.mk b/libc/Android.mk index e3c7a883a..5baf38113 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -887,6 +887,10 @@ LOCAL_MODULE := libc_bionic LOCAL_ADDITIONAL_DEPENDENCIES := $(libc_common_additional_dependencies) LOCAL_SYSTEM_SHARED_LIBRARIES := +# Set -DPTHREAD_DEBUG_ENABLED=true to enable support for pthread deadlock prediction. +# Since this code is experimental it is disabled by default. +LOCAL_CFLAGS += $(libc_common_cflags) -DPTHREAD_DEBUG_ENABLED=false + include $(BUILD_STATIC_LIBRARY) @@ -980,13 +984,7 @@ include $(BUILD_STATIC_LIBRARY) # ======================================================== include $(CLEAR_VARS) -# pthread deadlock prediction: -# set -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=1 to enable support for -# pthread deadlock prediction. -# Since this code is experimental it is disabled by default. -# see libc/bionic/pthread_debug.c for details - -LOCAL_CFLAGS := $(libc_common_cflags) -DPTHREAD_DEBUG -DPTHREAD_DEBUG_ENABLED=0 +LOCAL_CFLAGS := $(libc_common_cflags) LOCAL_CONLYFLAGS := $(libc_common_conlyflags) LOCAL_CPPFLAGS := $(libc_common_cppflags) LOCAL_C_INCLUDES := $(libc_common_c_includes) diff --git a/libc/bionic/pthread_mutex.cpp b/libc/bionic/pthread_mutex.cpp index 6b8215118..7e43cd841 100644 --- a/libc/bionic/pthread_mutex.cpp +++ b/libc/bionic/pthread_mutex.cpp @@ -553,13 +553,11 @@ int pthread_mutex_lock_impl(pthread_mutex_t *mutex) int pthread_mutex_lock(pthread_mutex_t *mutex) { int err = pthread_mutex_lock_impl(mutex); -#ifdef PTHREAD_DEBUG if (PTHREAD_DEBUG_ENABLED) { if (!err) { pthread_debug_mutex_lock_check(mutex); } } -#endif return err; } @@ -622,11 +620,9 @@ int pthread_mutex_unlock_impl(pthread_mutex_t *mutex) int pthread_mutex_unlock(pthread_mutex_t *mutex) { -#ifdef PTHREAD_DEBUG if (PTHREAD_DEBUG_ENABLED) { pthread_debug_mutex_unlock_check(mutex); } -#endif return pthread_mutex_unlock_impl(mutex); } @@ -678,13 +674,11 @@ int pthread_mutex_trylock_impl(pthread_mutex_t *mutex) int pthread_mutex_trylock(pthread_mutex_t *mutex) { int err = pthread_mutex_trylock_impl(mutex); -#ifdef PTHREAD_DEBUG if (PTHREAD_DEBUG_ENABLED) { if (!err) { pthread_debug_mutex_lock_check(mutex); } } -#endif return err; } @@ -819,13 +813,11 @@ int pthread_mutex_lock_timeout_np_impl(pthread_mutex_t *mutex, unsigned msecs) int pthread_mutex_lock_timeout_np(pthread_mutex_t *mutex, unsigned msecs) { int err = pthread_mutex_lock_timeout_np_impl(mutex, msecs); -#ifdef PTHREAD_DEBUG if (PTHREAD_DEBUG_ENABLED) { if (!err) { pthread_debug_mutex_lock_check(mutex); } } -#endif return err; }