svn commit: r1927913 - in apr/apr/branches/1.8.x: . memory/unix
[email protected] Wed, 20 Aug 2025 10:30:10 -0000
Newsgroups
gmane.comp.apache.apr.cvs
Message-ID
<175568581051.2849153.2022060814505972910@svn02-us-east.apache.org>
Author: brane
Date: Wed Aug 20 10:30:10 2025
New Revision: 1927913
Log:
Cherry-picked r1927658 from trunk to 1.8.x.
Modified:
apr/apr/branches/1.8.x/ (props changed)
apr/apr/branches/1.8.x/memory/unix/apr_pools.c
Modified: apr/apr/branches/1.8.x/memory/unix/apr_pools.c
==============================================================================
--- apr/apr/branches/1.8.x/memory/unix/apr_pools.c Wed Aug 20 10:29:45 2025 (r1927912)
+++ apr/apr/branches/1.8.x/memory/unix/apr_pools.c Wed Aug 20 10:30:10 2025 (r1927913)
@@ -590,6 +590,7 @@ struct apr_pool_t {
apr_os_thread_t owner;
apr_thread_mutex_t *mutex;
#endif /* APR_HAS_THREADS */
+ int unmanaged;
#endif /* APR_POOL_DEBUG */
#ifdef NETWARE
apr_os_proc_t owner_proc;
@@ -1605,7 +1606,8 @@ static void apr_pool_check_lifetime(apr_
* people have searched for the top level parent and
* started to use that...
*/
- if (pool == global_pool || global_pool == NULL)
+ if (pool == global_pool || global_pool == NULL
+ || (pool->parent == NULL && pool->unmanaged))
return;
/* Lifetime
@@ -2035,6 +2037,22 @@ APR_DECLARE(apr_status_t) apr_pool_creat
pool->owner_proc = (apr_os_proc_t)getnlmhandle();
#endif /* defined(NETWARE) */
+ if ((pool->parent = parent) != NULL) {
+ pool_lock(parent);
+
+ if ((pool->sibling = parent->child) != NULL)
+ pool->sibling->ref = &pool->sibling;
+
+ parent->child = pool;
+ pool->ref = &parent->child;
+
+ pool_unlock(parent);
+ }
+ else {
+ pool->sibling = NULL;
+ pool->ref = NULL;
+ }
+
#if APR_HAS_THREADS
if (parent == NULL || parent->allocator != allocator) {
apr_status_t rv;
@@ -2058,22 +2076,6 @@ APR_DECLARE(apr_status_t) apr_pool_creat
}
#endif /* APR_HAS_THREADS */
- if ((pool->parent = parent) != NULL) {
- pool_lock(parent);
-
- if ((pool->sibling = parent->child) != NULL)
- pool->sibling->ref = &pool->sibling;
-
- parent->child = pool;
- pool->ref = &parent->child;
-
- pool_unlock(parent);
- }
- else {
- pool->sibling = NULL;
- pool->ref = NULL;
- }
-
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
apr_pool_log_event(pool, "CREATE", file_line, 1);
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
@@ -2111,11 +2113,30 @@ APR_DECLARE(apr_status_t) apr_pool_creat
memset(pool, 0, SIZEOF_POOL_T);
+ pool->unmanaged = 1;
pool->abort_fn = abort_fn;
pool->tag = file_line;
pool->file_line = file_line;
#if APR_HAS_THREADS
+ pool->owner = apr_os_thread_current();
+#endif /* APR_HAS_THREADS */
+#ifdef NETWARE
+ pool->owner_proc = (apr_os_proc_t)getnlmhandle();
+#endif /* defined(NETWARE) */
+
+ if ((pool_allocator = allocator) == NULL) {
+ apr_status_t rv;
+ if ((rv = apr_allocator_create(&pool_allocator)) != APR_SUCCESS) {
+ if (abort_fn)
+ abort_fn(rv);
+ return rv;
+ }
+ pool_allocator->owner = pool;
+ }
+ pool->allocator = pool_allocator;
+
+#if APR_HAS_THREADS
{
apr_status_t rv;
@@ -2135,24 +2156,6 @@ APR_DECLARE(apr_status_t) apr_pool_creat
}
#endif /* APR_HAS_THREADS */
-#if APR_HAS_THREADS
- pool->owner = apr_os_thread_current();
-#endif /* APR_HAS_THREADS */
-#ifdef NETWARE
- pool->owner_proc = (apr_os_proc_t)getnlmhandle();
-#endif /* defined(NETWARE) */
-
- if ((pool_allocator = allocator) == NULL) {
- apr_status_t rv;
- if ((rv = apr_allocator_create(&pool_allocator)) != APR_SUCCESS) {
- if (abort_fn)
- abort_fn(rv);
- return rv;
- }
- pool_allocator->owner = pool;
- }
- pool->allocator = pool_allocator;
-
#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
apr_pool_log_event(pool, "CREATEU", file_line, 1);
#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */