[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1325478 - in /subversion/trunk/subversion: include/svn_pools.h libsvn_subr/pool.c

From: Daniel Shahaf <danielsh_at_elego.de>
Date: Fri, 13 Apr 2012 17:35:30 +0300

stefan2_at_apache.org wrote on Thu, Apr 12, 2012 at 20:02:37 -0000:
> Author: stefan2
> Date: Thu Apr 12 20:02:36 2012
> New Revision: 1325478
>
> URL: http://svn.apache.org/viewvc?rev=1325478&view=rev
> Log:
> Introduce a new API function to create and initialize a new
> APR pool allocator. Make its thread-safety properties
> explicit in the docstring.
>
> Will be used by the next commit to replace boilerplate code.
>
> * subversion/include/svn_pools.h
> (svn_pool_create_allocator): declare new API function
> * subversion/libsvn_subr/pool.c
> (svn_pool_create_allocator): declare new API function
>
> Modified:
> subversion/trunk/subversion/include/svn_pools.h
> subversion/trunk/subversion/libsvn_subr/pool.c
>
> Modified: subversion/trunk/subversion/include/svn_pools.h
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_pools.h?rev=1325478&r1=1325477&r2=1325478&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/include/svn_pools.h (original)
> +++ subversion/trunk/subversion/include/svn_pools.h Thu Apr 12 20:02:36 2012
> @@ -30,7 +30,7 @@
> #ifndef SVN_POOLS_H
> #define SVN_POOLS_H
>
> -#include <apr_pools.h>
> +#include "svn_types.h"
>
> #ifdef __cplusplus
> extern "C" {
> @@ -86,6 +86,23 @@ svn_pool_create_ex_debug(pool, allocator
> */
> #define svn_pool_destroy apr_pool_destroy
>
> +/** Return a new allocator. This function limits the unused memory in the
> + * new allocator to @ref SVN_ALLOCATOR_RECOMMENDED_MAX_FREE and ensures
> + * proper synchronization if the allocator is used by multiple threads.
> + *
> + * If your application uses multiple threads, creating a separate allocator
> + * for each of these threads may not be feasible. Set the @a thread_safe
> + * parameter to @c TRUE in that case. Pools will still not thread-safe, i.e.
> + * access to them may require explicit serialization. Set the parameter to
> + * @c FALSE, otherwise, to maximize performance.
> + *
> + * To access the owner pool, which can also serve as the root pool for your
> + * sub-pools, call @c apr_allocator_get_owner().
> + *
> + * @since: New in 1.8
> + */
> +apr_allocator_t *
> +svn_pool_create_allocator(svn_boolean_t thread_safe);

Should this be an svn-private API? Should it take a parameter
that allows overriding the SVN_ALLOCATOR_RECOMMENDED_MAX_FREE default?
Received on 2012-04-13 16:36:10 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.