apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yla...@apache.org
Subject svn commit: r1792621 - /apr/apr/trunk/locks/unix/proc_mutex.c
Date Tue, 25 Apr 2017 15:17:56 GMT
Author: ylavic
Date: Tue Apr 25 15:17:56 2017
New Revision: 1792621

URL: http://svn.apache.org/viewvc?rev=1792621&view=rev
Log:
locks: unix: provide a macro helper for a pattern used several times.
No functional change.


Modified:
    apr/apr/trunk/locks/unix/proc_mutex.c

Modified: apr/apr/trunk/locks/unix/proc_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/locks/unix/proc_mutex.c?rev=1792621&r1=1792620&r2=1792621&view=diff
==============================================================================
--- apr/apr/trunk/locks/unix/proc_mutex.c (original)
+++ apr/apr/trunk/locks/unix/proc_mutex.c Tue Apr 25 15:17:56 2017
@@ -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_u
     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_u
     }
     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_a
     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_r
     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;



Mime
View raw message