Philip Martin <philip@codematters.co.uk> writes:
> Joseph Galbraith <galb@vandyke.com> writes:
>
> > Garrett Rooney wrote:
> >> Static variables like that are not especially thread safe.
> >
> > Ahh... I think my second code snippet address this problem
> > as it does away with the bool and only uses the szAdmDir...
> > I'll quote it here for clarity:
> >
> > char* getadmdir()
> > {
> > static char* szAdmDir = 0;
> > if ( szAdmDir == 0 )
> > {
>
> Pointers are probably atomic on all the platforms that run Subversion,
> but strictly speaking it's not guaranteed and depends on the
> platform.
I'll demonstrate a little ignorance here, perhaps, but isn't thread
safety all about making sure different threads wouldn't get different
data or stomp on each other's data? It would seem that this wouldn't
really be likely to happen here. If you can safely assume that all
threads of a single application would have the same environment (which
might not be a safe assumption?), then at any given time, each thread
would either have szAdmDir set to 0 or to some string which would have
be the same string across all threads anyway.
Now, about that ignorance -- what did I miss?
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Jun 29 20:17:45 2005