summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2017-04-17 20:10:21 +0000
committerYann Ylavic <ylavic@apache.org>2017-04-17 20:10:21 +0000
commit47aa26240cbbb75609ed9ad75074d99069eaccc1 (patch)
treee52476d07dcec141b39bcc35f100ecad8b2a2702 /locks
parentf062fda2422a3fb401a7fe754d9805ed20c62942 (diff)
downloadapr-47aa26240cbbb75609ed9ad75074d99069eaccc1.tar.gz
Merge r1791718 from trunk:
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. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x@1791719 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/unix/proc_mutex.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/locks/unix/proc_mutex.c b/locks/unix/proc_mutex.c
index 3df7df8b8..2bd695dfd 100644
--- a/locks/unix/proc_mutex.c
+++ b/locks/unix/proc_mutex.c
@@ -493,7 +493,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)
@@ -527,7 +527,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
@@ -542,7 +543,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;
@@ -691,7 +693,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;
@@ -837,7 +840,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;