locks: follow up to r1790446.
Since proc_pthread_mutex_cond_locked() macro is also used as an lvalue, don't
define it as a conditional and put the condition where needed in the code.
@@ -487,7 +487,7 @@ typedef struct {
(proc_pthread_cast(m)->cond)
apr_int32_t cond_locked;
#define proc_pthread_mutex_cond_locked(m) \
- ((m)->pthread_refcounting ? proc_pthread_cast(m)->cond_locked : -1)
+ (proc_pthread_cast(m)->cond_locked)
apr_uint32_t cond_num_waiters;
#define proc_pthread_mutex_cond_num_waiters(m) \
(proc_pthread_cast(m)->cond_num_waiters)
@@ -521,7 +521,8 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_)
apr_status_t rv;
#if APR_USE_PROC_PTHREAD_MUTEX_COND
- if (proc_pthread_mutex_cond_locked(mutex) != -1) {
+ if (mutex->pthread_refcounting &&
+ proc_pthread_mutex_cond_locked(mutex) != -1) {
mutex->curr_locked = 0;
}
else
@@ -536,7 +537,8 @@ static apr_status_t proc_pthread_mutex_unref(void *mutex_)
}
if (!proc_pthread_mutex_dec(mutex)) {
#if APR_USE_PROC_PTHREAD_MUTEX_COND
- if (proc_pthread_mutex_cond_locked(mutex) != -1 &&
+ if (mutex->pthread_refcounting &&
+ proc_pthread_mutex_cond_locked(mutex) != -1 &&
(rv = pthread_cond_destroy(&proc_pthread_mutex_cond(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
@@ -685,7 +687,8 @@ 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 (proc_pthread_mutex_cond_locked(mutex) != -1) {
+ if (mutex->pthread_refcounting &&
+ proc_pthread_mutex_cond_locked(mutex) != -1) {
if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
@@ -831,7 +834,8 @@ 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 (proc_pthread_mutex_cond_locked(mutex) != -1) {
+ if (mutex->pthread_refcounting &&
+ proc_pthread_mutex_cond_locked(mutex) != -1) {
if ((rv = pthread_mutex_lock(&proc_pthread_mutex(mutex)))) {
#ifdef HAVE_ZOS_PTHREADS
rv = errno;
