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

Re: Are the Visual C++ Development libraries thread safe?

From: Greg Hudson <ghudson_at_MIT.EDU>
Date: 2004-06-28 05:14:24 CEST

On Sun, 2004-06-27 at 22:29, Ben Collins-Sussman wrote:
> All of the libsvn_* C libraries are thread-safe.

Uh, not entirely. Each time you open an ra_dav session, we call
ne_socket_init(), which uses nothing more than a "static int" to protect
against multiple initializations. Neon also provides no locking
callback to OpenSSL (nor can it do so without potentially interfering
with an application or other library), so OpenSSL may be operating in a
non-thread-safe manner.

Even if we sweep those small-but-essentially-unfixable issues under the
rug, our thread safety comes with some provisos:

  * Don't share svn structures like RA sessions between threads.
They're not internally locked.

  * Don't share an apr pool between threads. Although apr pools are
internally locked, the locking only applies to subpool creation, not
individual allocations.

  * Make sure to call apr_initialize() from the single-threaded
environment. (Corollary: if you're calling svn libraries from a
library, you have to impose this requirement on your application, or
provide a library initialization function which must be called from the
single-threaded environment.)

I can't guarantee that I've identified all of the issues and provisos.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 28 05:15:12 2004

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.