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

Re: A proposed solution for svn admin directory names

From: Garrett Rooney <rooneg_at_electricjellyfish.net>
Date: 2005-06-30 01:36:07 CEST

Jonathan Malek wrote:

> As to (2), we could use pthread (used by apr) and something like:
>
> pthread_mutex_t svn_admin_dir_mutex = PTHREAD_MUTEX_INITIALIZER ;
>
> char * getadmdir()
> {
> static char * szAdmDir = 0 ;
>
> pthread_mutex_lock( &svn_admin_dir_mutex ) ;
> if( szAdmDir == 0 )
> {
> szAdmDir = getenv( "SVN_ADM_DIR" ) ;
> if( szAdmDir == 0 )
> szAdmDir = ".svn" ;
> }
> pthread_mutex_unlock( &svn_admin_dir_mutex ) ;
>
> return szAdmDir ;
> }

Actually, APR mutexes don't have static initializers like pthread
mutexes, so you need to initialize them from some sort of init function
before they can be used. So for correct locking there has to be some
sort of global initialization function called before getadmdir is used.
  Yes, I agree this sucks, but those are the breaks...

-garrett

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Jun 30 01:43:28 2005

This is an archived mail posted to the Subversion Dev mailing list.