On 8/10/06, Philip Martin <philip@codematters.co.uk> wrote:
> "Vlad Georgescu" <vgeorgescu@gmail.com> writes:
>
> > +apr_status_t svn_ra_svn__sasl_common_init(void)
> > +{
> > + apr_status_t apr_err = APR_SUCCESS;
> > +
> > +#ifdef APR_HAS_THREADS
> > + sasl_set_mutex(sasl_mutex_alloc_cb,
> > + sasl_mutex_lock_cb,
> > + sasl_mutex_unlock_cb,
> > + sasl_mutex_free_cb);
> > + sasl_pool = svn_pool_create(NULL);
> > + apr_pool_cleanup_register(sasl_pool, NULL, sasl_done_cb,
> > + apr_pool_cleanup_null);
> > + free_mutexes = apr_array_make(sasl_pool, 0, sizeof(apr_thread_mutex_t *));
> > + apr_err = apr_thread_mutex_create(&array_mutex,
> > + APR_THREAD_MUTEX_DEFAULT,
> > + sasl_pool);
> > +#else
> > + atexit(sasl_done);
> > +#endif /* APR_HAS_THREADS */
> > + return apr_err;
> > +}
>
> I still think it's odd for the library to use atexit, and for the
> threaded/non-threaded code to be so different. Why doesn't the
> non-threaded code just use the threaded code but without the mutexes?
Sure, you could use the global pool and the pool cleanup in the
single-threaded case, but it doesn't really make sense. That pool is
only necessary for the mutex allocations, so you'd be creating a pool
just to register a cleanup for it.
--
Vlad
---------------------------------------------------------------------
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:47:22 2006