From 66759d6041b33706c3a92dde48492ba4f2bbab2f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 31 Oct 2013 14:09:39 -0700 Subject: [PATCH] Move the pthread debugging flags to the right place. Change-Id: Ie805bd837d1f72cdf1818e056c0baeb0857e4e84 --- libc/Android.mk | 12 +++++------- libc/bionic/pthread_mutex.cpp | 8 -------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/libc/Android.mk b/libc/Android.mk index e860d17f9..1496d1f06 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -886,6 +886,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) @@ -979,13 +983,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; } -- 2.11.0