apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rpl...@apache.org
Subject svn commit: r759519 - /apr/apr/trunk/memory/unix/apr_pools.c
Date Sat, 28 Mar 2009 17:41:34 GMT
Author: rpluem
Date: Sat Mar 28 17:41:33 2009
New Revision: 759519

URL: http://svn.apache.org/viewvc?rev=759519&view=rev
Log:
* The previous pool implementation used a less fine grained locking
  mechanism. If it was not provided with a separate allocator
  it used the parent allocator for locking.
  Use the still present allocator argument to apr_pool_create_ex to
  determine the correct level of granularity: If no allocator is passed
  in use the mutex from the parent instead of creating a new one by
  our self.

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=759519&r1=759518&r2=759519&view=diff
==============================================================================
--- apr/apr/trunk/memory/unix/apr_pools.c (original)
+++ apr/apr/trunk/memory/unix/apr_pools.c Sat Mar 28 17:41:33 2009
@@ -812,7 +812,6 @@
     pool = malloc(sizeof(apr_pool_t));
     pool->abort_fn = abort_fn;
     pool->child = NULL;
-    pool->cleanups = NULL;
     pool->free_cleanups = NULL;
     pool->pre_cleanups = NULL;
     pool->free_pre_cleanups = NULL;
@@ -820,12 +819,21 @@
     pool->user_data = NULL;
     pool->tag = NULL;
 
-    pool->blocks = &pool->final_block;
-    pool->blocks->offset = 0;
-    pool->blocks->next = NULL;
-    (void)apr_thread_mutex_create(&pool->mutex,
-                                  APR_THREAD_MUTEX_NESTED, pool);
-    pool->final_cleanups = pool->cleanups;
+    if (allocator) {
+        pool->blocks = &pool->final_block;
+        pool->blocks->offset = 0;
+        pool->blocks->next = NULL;
+        pool->cleanups = NULL;
+        (void)apr_thread_mutex_create(&pool->mutex,
+                                      APR_THREAD_MUTEX_NESTED, pool);
+        pool->final_cleanups = pool->cleanups;
+    }
+    else {
+        pool->final_cleanups = NULL;
+        pool->final_block.offset = 0;
+        pool->final_block.next = NULL;
+        pool->mutex = parent->mutex;
+    }
     pool->blocks = &pool->first_block;
     pool->blocks->offset = 0;
     pool->blocks->next = NULL;



Mime
View raw message