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

Re: thread safe

From: Stefan Küng <tortoisesvn_at_gmail.com>
Date: Tue, 04 Sep 2012 20:42:33 +0200

On 04.09.2012 20:31, Branko Čibej wrote:
> On 04.09.2012 19:33, Stefan Küng wrote:
>> On 03.09.2012 22:21, Branko Čibej wrote:
>>> On 03.09.2012 22:16, Stefan Küng wrote:
>>>> On 03.09.2012 22:11, Branko Čibej wrote:
>>>>> Either that, or add a new API that creates a deep-copy of the
>>>>> in-memory
>>>>> svn_config_t structure, making this another way to avoid re-reading
>>>>> the
>>>>> config file for each thread and avoiding the hassle of managing a
>>>>> mutex.
>>>>
>>>> I'm in favor of implementing a deep copy API for this. I think that
>>>> would be the best solution.
>>>
>>> I find it to be the best option, too. Will you write a patch for that?
>>
>> Ahem:
>> apr_hash_copy
>> will do the trick: svn_config_t is a typedef for an apr_hash_t.
>
> Really? That's strange; are you quite sure you're looking at the right code?
> subversion/libsvn_subr/config_impl.h says:
>
> struct svn_config_t
> {
> /* Table of cfg_section_t's. */
> apr_hash_t *sections;
>
> /* Pool for hash tables, table entries and unexpanded values */
> apr_pool_t *pool;
>
> /* Pool for expanded values -- this is separate, so that we can
> clear it when modifying the config data. */
> apr_pool_t *x_pool;
>
> /* Indicates that some values in the configuration have been expanded. */
> svn_boolean_t x_values;
>
> /* Temporary string used for lookups. (Using a stringbuf so that
> frequent resetting is efficient.) */
> svn_stringbuf_t *tmp_key;
>
> /* Temporary value used for expanded default values in svn_config_get.
> (Using a stringbuf so that frequent resetting is efficient.) */
> svn_stringbuf_t *tmp_value;
>
> /* Specifies whether section names are populated case sensitively. */
> svn_boolean_t section_names_case_sensitive;
> };
>
>
>> So it's already done :)
>
> Not even close, I'm afraid.

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.

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.

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.

Stefan

-- 
        ___
   oo  // \\      "De Chelonian Mobile"
  (_,\/ \_/ \     TortoiseSVN
    \ \_/_\_/>    The coolest Interface to (Sub)Version Control
    /_/   \_\     http://tortoisesvn.net
Received on 2012-09-04 20:43:09 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.