summaryrefslogtreecommitdiff
path: root/memory
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2020-11-24 23:45:34 +0000
committerYann Ylavic <ylavic@apache.org>2020-11-24 23:45:34 +0000
commit3d2004b3ee3cc42b411d6bc53a30698360d3ae54 (patch)
treef763ebe915cdc0f9fa14d471055e568d1048c678 /memory
parent69e15d521b2186c9c1b46caa3a54ebad7645c622 (diff)
downloadapr-3d2004b3ee3cc42b411d6bc53a30698360d3ae54.tar.gz
Revert incorrect r1883803 (unmatched lock/unlock), will recommit.
[Correct commit in r1883805] git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1883804 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memory')
-rw-r--r--memory/unix/apr_pools.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c
index 55372fede..99abb6920 100644
--- a/memory/unix/apr_pools.c
+++ b/memory/unix/apr_pools.c
@@ -1012,12 +1012,20 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool)
/* Remove the pool from the parents child list */
if (pool->parent) {
- allocator_lock(pool->parent->allocator);
+#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 */
if ((*pool->ref = pool->sibling) != NULL)
pool->sibling->ref = pool->ref;
- allocator_unlock(pool->parent->allocator);
+#if APR_HAS_THREADS
+ if (mutex)
+ apr_thread_mutex_unlock(mutex);
+#endif /* APR_HAS_THREADS */
}
/* Find the block attached to the pool structure. Save a copy of the
@@ -1120,7 +1128,12 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
#endif /* defined(NETWARE) */
if ((pool->parent = parent) != NULL) {
- allocator_lock(parent->allocator);
+#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 */
if ((pool->sibling = parent->child) != NULL)
pool->sibling->ref = &pool->sibling;
@@ -1128,7 +1141,10 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
parent->child = pool;
pool->ref = &parent->child;
- allocator_lock(parent->allocator);
+#if APR_HAS_THREADS
+ if (mutex)
+ apr_thread_mutex_unlock(mutex);
+#endif /* APR_HAS_THREADS */
}
else {
pool->sibling = NULL;