You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2009/09/09 20:46:05 UTC

svn commit: r813071 - in /apr/apr/trunk: CHANGES include/apr_pools.h

Author: minfrin
Date: Wed Sep  9 18:46:05 2009
New Revision: 813071

URL: http://svn.apache.org/viewvc?rev=813071&view=rev
Log:
Add comments describing the thread-safety properties of apr_pool_t.
Submitted by: Neil Conway nrc cs.berkeley.edu

Modified:
    apr/apr/trunk/CHANGES
    apr/apr/trunk/include/apr_pools.h

Modified: apr/apr/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/trunk/CHANGES?rev=813071&r1=813070&r2=813071&view=diff
==============================================================================
--- apr/apr/trunk/CHANGES [utf-8] (original)
+++ apr/apr/trunk/CHANGES [utf-8] Wed Sep  9 18:46:05 2009
@@ -5,6 +5,9 @@
      Fix overflow in pools and rmm, where size alignment was taking place.
      [Matt Lewis <ma...@google.com>, Sander Striker]
 
+  *) Add comments describing the thread-safety properties of apr_pool_t.
+     [Neil Conway nrc cs.berkeley.edu]
+
   *) Pass default environment to testflock, testoc, testpipe, testsock,
      testshm and testproc children, so that tests run when APR is compiled
      with Intel C Compiler. [Bojan Smojver]

Modified: apr/apr/trunk/include/apr_pools.h
URL: http://svn.apache.org/viewvc/apr/apr/trunk/include/apr_pools.h?rev=813071&r1=813070&r2=813071&view=diff
==============================================================================
--- apr/apr/trunk/include/apr_pools.h (original)
+++ apr/apr/trunk/include/apr_pools.h Wed Sep  9 18:46:05 2009
@@ -28,10 +28,16 @@
  * particularly in the presence of die()).
  *
  * Instead, we maintain pools, and allocate items (both memory and I/O
- * handlers) from the pools --- currently there are two, one for per
- * transaction info, and one for config info.  When a transaction is over,
- * we can delete everything in the per-transaction apr_pool_t without fear,
- * and without thinking too hard about it either.
+ * handlers) from the pools --- currently there are two, one for
+ * per-transaction info, and one for config info.  When a transaction is
+ * over, we can delete everything in the per-transaction apr_pool_t without
+ * fear, and without thinking too hard about it either.
+ *
+ * Note that most operations on pools are not thread-safe: a single pool
+ * should only be accessed by a single thread at any given time. The one
+ * exception to this rule is creating a subpool of a given pool: one or more
+ * threads can safely create subpools at the same time that another thread
+ * accesses the parent pool.
  */
 
 #include "apr.h"
@@ -182,6 +188,10 @@
  * @param abort_fn A function to use if the pool cannot allocate more memory.
  * @param allocator The allocator to use with the new pool.  If NULL the
  *        allocator of the parent pool will be used.
+ * @remark This function is thread-safe, in the sense that multiple threads
+ *         can safely create subpools of the same parent pool concurrently.
+ *         Similarly, a subpool can be created by one thread at the same
+ *         time that another thread accesses the parent pool.
  */
 APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
                                              apr_pool_t *parent,
@@ -291,6 +301,10 @@
  *        pool.  If it is non-NULL, the new pool will inherit all
  *        of its parent pool's attributes, except the apr_pool_t will
  *        be a sub-pool.
+ * @remark This function is thread-safe, in the sense that multiple threads
+ *         can safely create subpools of the same parent pool concurrently.
+ *         Similarly, a subpool can be created by one thread at the same
+ *         time that another thread accesses the parent pool.
  */
 #if defined(DOXYGEN)
 APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool,
@@ -330,7 +344,7 @@
 #endif
 
 /**
- * Find the pools allocator
+ * Find the pool's allocator
  * @param pool The pool to get the allocator from.
  */
 APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool);



Re: svn commit: r813071 - in /apr/apr/trunk: CHANGES include/apr_pools.h

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Sep 9, 2009 at 3:20 PM, Graham Leggett <mi...@sharp.fm> wrote:

> Jeff Trawick wrote:
>
> > too trivial for CHANGES...  waste of time for people looking there for
> > interesting changes...
>
> It was contributed by someone external to apr, and having banged my head
> against the same shortcomings in documentation, such contributions are
> very valuable and should be properly credited.
>

I don't mind the general idea of giving a little boost to the perceived
importance of an outside contribution in order to justify listing it in
CHANGES.  However, at the current rate I suspect that CHANGES will be half
drivel before long.

Re: svn commit: r813071 - in /apr/apr/trunk: CHANGES include/apr_pools.h

Posted by Graham Leggett <mi...@sharp.fm>.
Jeff Trawick wrote:

> too trivial for CHANGES...  waste of time for people looking there for
> interesting changes...

It was contributed by someone external to apr, and having banged my head
against the same shortcomings in documentation, such contributions are
very valuable and should be properly credited.

Regards,
Graham
--


Re: svn commit: r813071 - in /apr/apr/trunk: CHANGES include/apr_pools.h

Posted by Jeff Trawick <tr...@gmail.com>.
On Wed, Sep 9, 2009 at 2:46 PM, <mi...@apache.org> wrote:

> Author: minfrin
> Date: Wed Sep  9 18:46:05 2009
> New Revision: 813071
>
> URL: http://svn.apache.org/viewvc?rev=813071&view=rev
> Log:
> Add comments describing the thread-safety properties of apr_pool_t.
> Submitted by: Neil Conway nrc cs.berkeley.edu
>
> Modified:
>    apr/apr/trunk/CHANGES
>

too trivial for CHANGES...  waste of time for people looking there for
interesting changes...