From: Ken Raeburn Date: Fri, 14 Jan 2005 05:03:48 +0000 (+0000) Subject: * k5-thread.h (k5_pthread_assert_locked): Only call pthread_equal if X-Git-Tag: ms-bug-test-20060525~376 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c8fcc72982cb9c4718fd520d70e69d3a30c0af15;p=krb5.git * k5-thread.h (k5_pthread_assert_locked): Only call pthread_equal if thread support is loaded. (k5_pthread_mutex_unlock): Use k5_pthread_assert_locked instead of duplicating it. ticket: 2878 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17036 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index 95d117b8c..0c2ba2c8a 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -4,7 +4,7 @@ if DEBUG_THREADS. (k5_pthread_mutex_lock, k5_pthread_mutex_unlock, k5_pthread_assert_locked): New macros/functions; if DEBUG_THREADS, - set or check the owner field. + and thread support loaded, set or check the owner field. (K5_OS_MUTEX_PARTIAL_INITIALIZER) [pthread case && DEBUG_THREADS]: Set the owner field. If PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP is defined, use it. diff --git a/src/include/k5-thread.h b/src/include/k5-thread.h index 32b793d37..88a14caab 100644 --- a/src/include/k5-thread.h +++ b/src/include/k5-thread.h @@ -489,11 +489,13 @@ k5_pthread_mutex_lock(k5_os_mutex *m) return 0; } # endif -# define k5_pthread_assert_locked(M) \ - (assert(pthread_equal((M)->owner, pthread_self()))) -# define k5_pthread_mutex_unlock(M) \ - (assert(pthread_equal((M)->owner, pthread_self())), \ - (M)->owner = (pthread_t) 0, \ +# define k5_pthread_assert_locked(M) \ + (K5_PTHREADS_LOADED \ + ? assert(pthread_equal((M)->owner, pthread_self())) \ + : (void)0) +# define k5_pthread_mutex_unlock(M) \ + (k5_pthread_assert_locked(M), \ + (M)->owner = (pthread_t) 0, \ pthread_mutex_unlock(&(M)->p)) #else # define k5_pthread_mutex_lock(M) pthread_mutex_lock(&(M)->p)