striker 02/01/15 00:29:35
Modified: memory/unix apr_pools.c
Log:
Move around the creation of the lock and adding the pool to the
parent pools child list. This gets us a working APR_POOL_DEBUG.
Revision Changes Path
1.138 +22 -22 apr/memory/unix/apr_pools.c
Index: apr_pools.c
===================================================================
RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -u -r1.137 -r1.138
--- apr_pools.c 14 Jan 2002 13:45:19 -0000 1.137
+++ apr_pools.c 15 Jan 2002 08:29:35 -0000 1.138
@@ -1069,7 +1069,7 @@
#if defined(APR_POOL_DEBUG_VERBOSE)
if (file_stderr) {
apr_file_printf(file_stderr,
- "POOL DEBUG: CLEAR [%10lu/%10lu/%10lu] "
+ "POOL DEBUG: CLEAR [%10lu/%10lu/%10lu] "
"0x%08X \"%s\" [%s] (%u/%u/%u)\n",
(unsigned long)apr_pool_num_bytes(pool, 0),
(unsigned long)apr_pool_num_bytes(pool, 1),
@@ -1158,6 +1158,27 @@
pool->file_line = file_line;
pool->creation_flags = flags;
+ if ((pool->parent = parent) != NULL) {
+#if APR_HAS_THREADS
+ if (parent->mutex)
+ apr_thread_mutex_lock(parent->mutex);
+#endif
+ if ((pool->sibling = parent->child) != NULL)
+ pool->sibling->ref = &pool->sibling;
+
+ parent->child = pool;
+ pool->ref = &parent->child;
+
+#if APR_HAS_THREADS
+ if (parent->mutex)
+ apr_thread_mutex_unlock(parent->mutex);
+#endif
+ }
+ else {
+ pool->sibling = NULL;
+ pool->ref = NULL;
+ }
+
if ((flags & APR_POOL_FNEW_ALLOCATOR) == APR_POOL_FNEW_ALLOCATOR) {
#if APR_HAS_THREADS
apr_status_t rv;
@@ -1182,27 +1203,6 @@
if (parent)
pool->mutex = parent->mutex;
#endif
- }
-
- if ((pool->parent = parent) != NULL) {
-#if APR_HAS_THREADS
- if (parent->mutex)
- apr_thread_mutex_lock(parent->mutex);
-#endif
- if ((pool->sibling = parent->child) != NULL)
- pool->sibling->ref = &pool->sibling;
-
- parent->child = pool;
- pool->ref = &parent->child;
-
-#if APR_HAS_THREADS
- if (parent->mutex)
- apr_thread_mutex_unlock(parent->mutex);
-#endif
- }
- else {
- pool->sibling = NULL;
- pool->ref = NULL;
}
*newpool = pool;