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

Re: ra_svn and thread-safety/initialization

From: <rbb_at_rkbloom.net>
Date: 2003-06-01 07:52:18 CEST

On 31 May 2003, Greg Hudson wrote:

> On Sat, 2003-05-31 at 13:16, rbb@rkbloom.net wrote:
> > Why can't you use apr_thread_once? Just put the initialization steps in a
> > function that is called through apr_thread_once, and you will be
> > guaranteed that the function will be called one time and only one time.
>
> It looks like I have an initialize an apr_thread_once_t with
> apr_thread_once_init(). I can't do that each time svn_ra_svn_init() is
> called, so where can I do it?

Two things. 1) APR not having a static initializer that you can use is a
pretty major bug that makes apr_thread_once a lot less useful. It's my
fault, I wrote the function originally, and I didn't think that through.
It should be a relatively easy patch to create one. That would be one way
to resolve the problem.

2) I haven't read the ra_svn code, so I am just spitballing here, but
there must be some place that you can call apr_thread_once_init before
you create threads. If there isn't, then you will need to modify APR to
include a static initializer.

Right now I feel like a moron for leaving that out. I wonder how many
other places need a static initializer that I didn't think about.

Ryan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jun 1 07:40:36 2003

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.