summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2005-01-14 05:03:48 +0000
committerKen Raeburn <raeburn@mit.edu>2005-01-14 05:03:48 +0000
commitc8fcc72982cb9c4718fd520d70e69d3a30c0af15 (patch)
tree6c67edb6be84f7de81bd6db8ce2bc5ecf66cc87d /src
parente9e0c8766bc7343b03ffd05abe08362cb6d755a9 (diff)
downloadkrb5-c8fcc72982cb9c4718fd520d70e69d3a30c0af15.tar.gz
krb5-c8fcc72982cb9c4718fd520d70e69d3a30c0af15.tar.xz
krb5-c8fcc72982cb9c4718fd520d70e69d3a30c0af15.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/include/ChangeLog2
-rw-r--r--src/include/k5-thread.h12
2 files changed, 8 insertions, 6 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog
index 95d117b8cb..0c2ba2c8a9 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 32b793d376..88a14caabd 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)