You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2020/11/24 23:25:53 UTC

svn commit: r1883803 - /apr/apr/trunk/memory/unix/apr_pools.c

Author: ylavic
Date: Tue Nov 24 23:25:53 2020
New Revision: 1883803

URL: http://svn.apache.org/viewvc?rev=1883803&view=rev
Log:
apr_pools: two more uses of allocator_[un]lock() helpers to simplify the code.

Modified:
    apr/apr/trunk/memory/unix/apr_pools.c

Modified: apr/apr/trunk/memory/unix/apr_pools.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/memory/unix/apr_pools.c?rev=1883803&r1=1883802&r2=1883803&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Tue Nov 24 23:25:53 2020
@@ -1012,20 +1012,12 @@ APR_DECLARE(void) apr_pool_destroy(apr_p
 
     /* Remove the pool from the parents child list */
     if (pool->parent) {
-#if APR_HAS_THREADS
-        apr_thread_mutex_t *mutex;
-
-        if ((mutex = apr_allocator_mutex_get(pool->parent->allocator)) != NULL)
-            apr_thread_mutex_lock(mutex);
-#endif /* APR_HAS_THREADS */
+        allocator_lock(pool->parent->allocator);
 
         if ((*pool->ref = pool->sibling) != NULL)
             pool->sibling->ref = pool->ref;
 
-#if APR_HAS_THREADS
-        if (mutex)
-            apr_thread_mutex_unlock(mutex);
-#endif /* APR_HAS_THREADS */
+        allocator_unlock(pool->parent->allocator);
     }
 
     /* Find the block attached to the pool structure.  Save a copy of the
@@ -1128,12 +1120,7 @@ APR_DECLARE(apr_status_t) apr_pool_creat
 #endif /* defined(NETWARE) */
 
     if ((pool->parent = parent) != NULL) {
-#if APR_HAS_THREADS
-        apr_thread_mutex_t *mutex;
-
-        if ((mutex = apr_allocator_mutex_get(parent->allocator)) != NULL)
-            apr_thread_mutex_lock(mutex);
-#endif /* APR_HAS_THREADS */
+        allocator_lock(parent->allocator);
 
         if ((pool->sibling = parent->child) != NULL)
             pool->sibling->ref = &pool->sibling;
@@ -1141,10 +1128,7 @@ APR_DECLARE(apr_status_t) apr_pool_creat
         parent->child = pool;
         pool->ref = &parent->child;
 
-#if APR_HAS_THREADS
-        if (mutex)
-            apr_thread_mutex_unlock(mutex);
-#endif /* APR_HAS_THREADS */
+        allocator_lock(parent->allocator);
     }
     else {
         pool->sibling = NULL;