On 8/9/06, Philip Martin <philip@codematters.co.uk> wrote:
> Greg Hudson <ghudson@MIT.EDU> writes:
>
> > 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.
>
> I suppose that's possible, but I think of the code:
>
> svn_error_t *foo(....)
> {
> ...
> SVN_ERR(svn_atomic_init_once(&once, some_func));
> ...
> }
>
> as more-or-less equivalent to:
>
> svn_error_t *foo(....)
> {
> ...
> SVN_ERR(some_func());
> ...
> }
>
> and it doesn't seem unreasonable to pass arguments to some_func.
> Suppose we wanted to use the application's apr_allocator_t when
> creating top-level pools in some_func? Using a global variable might
> work, but in that case we probably wouldn't need svn_atomic_init_once
> in the first place.
Realistically, I don't think this is a likely use case, but
fortunately, it doesn't matter. This is not a public interface, we
are not installing the header that describes it, so we can change it
later if it ever becomes necessary.
-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:37:07 2006