On 8/9/06, Daniel Rall <dlr@collab.net> wrote:
> On Wed, 09 Aug 2006, Greg Hudson wrote:
>
> > On Aug 9, 2006, at 5:33 PM, Philip Martin wrote:
> > >
> > >Will this always be used in places where no parameters need to be
> > >passed? How about:
> > >
> > > svn_error_t *
> > > svn_atomic_init_once(volatile svn_atomic_t *global_status,
> > > svn_error_t *(*init_func)(void *baton),
> > > void *baton);
> >
> > Huh. Can you think of a case where it makes sense to pass parameters
> > to an atomic initialization function? My intuition is that if you
> > want to do that, your designed is subtly wrong.
>
> Garrett also wrote:
>
> > Generally, if it's something that only has to occur once it's a
> > global initialization, which means you're initializing globals, so a
> > baton is unnecessary, but I suppose someone might come up with a
> > reason to pass one in, so sure, why not. Will look at adding one.
>
> What if you needed to pass in some state (e.g. pool-like thing,
> context, whatever) to determine how to initialize the globals?
Any pool used to initialize globals is probably also global. I mean
it doesn't have to be, but you'd have to be careful to make sure that
when the pool was destroyed you NULL out the globals that allocated
memory in them, and there'd be nasty thread safety isses, and so on...
-garrett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Aug 10 00:14:35 2006