On Sat, Oct 15, 2011 at 09:03:08AM -0000, stef...@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)
{
#if APR_HAS_THREADS
  *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?

Reply via email to