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

svn_pool_xxx vs apr_pool_xxx

From: Sander Striker <striker_at_apache.org>
Date: 2003-08-15 19:28:39 CEST

Hi,

Revision 3719 positively changed the way we handle errors. Thanks
to that there is no need for us to have a special svn top level pool
anymore.

Furthermore, the code that is in place is dangerous in a threaded
environment, after the 'top level' pool is cleared:

---
SVN_POOL_FUNC_DEFINE(void, svn_pool_clear)
{
  void *is_root;
                                                                                                                                                          
  /* Clear the pool.  All userdata of this pool is now invalid. */
#if !APR_POOL_DEBUG
  apr_pool_clear (pool);
#else /* APR_POOL_DEBUG */
  apr_pool_clear_debug (pool, file_line);
#endif /* APR_POOL_DEBUG */
                                                                                                                                                             
  apr_pool_userdata_get (&is_root, SVN_POOL_ROOTED_HERE, pool);
  if (is_root)
---
Notice the comment about userdata.  is_root will always be NULL.
This results in an allocator without a mutex, which is fine for
our cmdline client, which doesn't clear the tl pool anyway. However,
other implementations might use the API differently, even creating
multiple 'top level' pools (by passing a NULL parent).
It's a bug that's easily fixed, but we have no use for all this
complexity, and hence we can do away with it.
We can safely replace all the svn_pool_xxx calls with apr_pool_xxx
calls, minding a slight difference in API.  An annoying one at that.
The current pattern is:
  pool = svn_pool_create(parent_pool);
While the apr pattern is:
  apr_pool_create(&pool, parent_pool);
If I hear no objections, I'll make this change happen.
Sander
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Aug 15 19:29:30 2003

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.