diff options
-rw-r--r-- | locks/unix/proc_mutex.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c index 3dedbefca..5ed289b60 100644 --- a/locks/unix/proc_mutex.c +++ b/locks/unix/proc_mutex.c @@ -491,6 +491,8 @@ typedef struct { apr_uint32_t cond_num_waiters; #define proc_pthread_mutex_cond_num_waiters(m) \ (proc_pthread_cast(m)->cond_num_waiters) +#define proc_pthread_mutex_is_cond(m) \ + ((m)->pthread_refcounting && proc_pthread_mutex_cond_locked(m) != -1) #endif /* APR_USE_PROC_PTHREAD_MUTEX_COND */ apr_uint32_t refcount; #define proc_pthread_mutex_refcount(m) \ @@ -521,8 +523,7 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_) apr_status_t rv; #if APR_USE_PROC_PTHREAD_MUTEX_COND - if (mutex->pthread_refcounting && - proc_pthread_mutex_cond_locked(mutex) != -1) { + if (proc_pthread_mutex_is_cond(mutex)) { mutex->curr_locked = 0; } else @@ -537,8 +538,7 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_) } if (!proc_pthread_mutex_dec(mutex)) { #if APR_USE_PROC_PTHREAD_MUTEX_COND - if (mutex->pthread_refcounting && - proc_pthread_mutex_cond_locked(mutex) != -1 && + if (proc_pthread_mutex_is_cond(mutex) && (rv = pthread_cond_destroy(&proc_pthread_mutex_cond(mutex)))) { #ifdef HAVE_ZOS_PTHREADS rv = errno; @@ -684,8 +684,7 @@ static apr_status_t proc_mutex_pthread_acquire_ex(apr_proc_mutex_t *mutex, apr_status_t rv; #if APR_USE_PROC_PTHREAD_MUTEX_COND - if (mutex->pthread_refcounting && - proc_pthread_mutex_cond_locked(mutex) != -1) { + if (proc_pthread_mutex_is_cond(mutex)) { if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) { #ifdef HAVE_ZOS_PTHREADS rv = errno; @@ -835,8 +834,7 @@ static apr_status_t proc_mutex_pthread_release(apr_proc_mutex_t *mutex) apr_status_t rv; #if APR_USE_PROC_PTHREAD_MUTEX_COND - if (mutex->pthread_refcounting && - proc_pthread_mutex_cond_locked(mutex) != -1) { + if (proc_pthread_mutex_is_cond(mutex)) { if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) { #ifdef HAVE_ZOS_PTHREADS rv = errno; |