svn commit: r1927912 - in apr/apr/branches/1.7.x: . memory/unix

[email protected]
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <175568578610.2847904.5442636080566744806@svn02-us-east.apache.org>
Author: brane
Date: Wed Aug 20 10:29:45 2025
New Revision: 1927912

Log:
Cherry-picked r1927658 from trunk to 1.7.x.

Modified:
   apr/apr/branches/1.7.x/   (props changed)
   apr/apr/branches/1.7.x/memory/unix/apr_pools.c

Modified: apr/apr/branches/1.7.x/memory/unix/apr_pools.c
==============================================================================
--- apr/apr/branches/1.7.x/memory/unix/apr_pools.c	Wed Aug 20 09:35:59 2025	(r1927911)
+++ apr/apr/branches/1.7.x/memory/unix/apr_pools.c	Wed Aug 20 10:29:45 2025	(r1927912)
@@ -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) */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.