diff options
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/ChangeLog | 2 | ||||
| -rw-r--r-- | src/include/k5-thread.h | 12 |
2 files changed, 8 insertions, 6 deletions
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) |
