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

Re: svn commit: r1183603 - in /subversion/trunk/subversion: include/private/svn_mutex.h libsvn_fs/fs-loader.c libsvn_fs_base/bdb/env.c libsvn_subr/dso.c libsvn_subr/svn_mutex.c tests/libsvn_subr/cache-test.c

From: Stefan Sperling <stsp_at_elego.de>
Date: Sat, 15 Oct 2011 13:06:03 +0200

On Sat, Oct 15, 2011 at 09:03:08AM -0000, stefan2_at_apache.org wrote:
> Author: stefan2
> Date: Sat Oct 15 09:03:08 2011
> New Revision: 1183603
> URL: http://svn.apache.org/viewvc?rev=1183603&view=rev
> Log:
> Slightly changing the semantics of svn_mutex__init(). If the
> enable_mutex parameter has been set, the function will try
> to enable the the mutex only if SVN is potentially multi-threaded,
> i.e. if APR_HAS_THREADS is set.
> Thus, the parameter can simply be set to TRUE, if we would
> need synchronization in a multi-threaded environment.

Quoting a bit of the code:

svn_mutex__init(svn_mutex__t **mutex_p,
                svn_boolean_t enable_mutex,
                apr_pool_t *result_pool)
  *mutex_p = NULL;
  if (enable_mutex)

*mutex_p not initialised if APR doesn't have threads.
Is this safe?

It seems odd to have a function that says "I will init mutexes"
with a parameter that says "don't init mutexes".
Can't we just set a mutex pointer to NULL instead of calling
svn_mutex__init() with enable_mutex == FALSE, and remove the
enable_mutex parameter?
Received on 2011-10-15 13:06:41 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.