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

Re: Is svn_config_get() not thread-safe?

From: David Glasser <glasser_at_davidglasser.net>
Date: Tue, 25 Mar 2008 21:41:58 -0700

On Tue, Mar 25, 2008 at 8:40 PM, Karl Fogel <kfogel_at_red-bean.com> wrote:
> Read the third paragraph of this doc string and tell me there isn't
> something wrong here:
>
> /** Find the value of a (@a section, @a option) pair in @a cfg, set @a
> * *valuep to the value.
> *
> * If @a cfg is @c NULL, just sets @a *valuep to @a default_value. If
> * the value does not exist, expand and return @a default_value. @a
> * default_value can be NULL.
> *
> * The returned value will be valid at least until the next call to
> * svn_config_get(), or for the lifetime of @a default_value. It is
> * safest to consume the returned value immediately.
> *
> * This function may change @a cfg by expanding option values.
> */
> void svn_config_get(svn_config_t *cfg, const char **valuep,
> const char *section, const char *option,
> const char *default_value);
>
> The implementation bears out the doc string's claim. (See the code
> below, with notes from me marked with "###".) But this is bogosity:
> another thread could call svn_config_get() and wipe out *valuep before
> the first caller ever has a chance to "consume" (e.g., copy) the value.

Well, specifically it's "the next call to svn_config_get() with the
same svn_config_t". Does that make it any better?

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-26 05:42:08 CET

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.