subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko Čibej <br...@wandisco.com>
Subject Re: thread safe
Date Tue, 04 Sep 2012 19:07:20 GMT
On 04.09.2012 20:42, Stefan Küng wrote:
> Seems I got confused here:
> What we have to pass to almost each svn API is the config hash for the
> svn_client_ctx_t struct. That's what I need a copy of.

The svn_config_* functions work with svn_config_t object. The tmp_key
and tmp_value fields in those object are in fact the ones that prevent
you from reading the same svn_config_t from multiple threads without
synchronization.

> And as Bert already noticed: apr_hash_copy only does a shallow copy,
> not a deep copy. Seems I have to iterate over the hash and copy every
> item separately.

That is correct. You'll also have to duplicate the svn_config_t
structure itself, I think that essentially means doing an
svn_config_create and copying over "x_values" and
"section_names_case_sensitive"; and, of course, doing the deep copy of
"sections".

If you do the deep copy properly -- i.e., copying the keys and values
into the new config_t's pool as well as the hashes -- then you'll save
yourself a bit of trouble with pool lifetimes, too.

> I'll do that first in TSVN, then do some tests.
> After that I can use that code to create an svn_config_dup() API if
> still required.

Why not just write svn_config_dup in libsvn_subr/config.c? Surely
there's no reason to keep this functionality out of the core libraries.

-- Brane

-- 
Certified & Supported Apache Subversion Downloads:
http://www.wandisco.com/subversion/download


Mime
View raw message