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

Re: [PATCH] Client-side support for Cyrus SASL

From: Vlad Georgescu <vgeorgescu_at_gmail.com>
Date: 2006-06-19 19:09:56 CEST

On 6/19/06, Garrett Rooney <rooneg@electricjellyfish.net> wrote:
> On 6/17/06, Vlad Georgescu <vgeorgescu@gmail.com> wrote:
> > Also, how do we make sure that sasl_{client,server}_init() is only
> > called once? I dug up this thread from the archives:
> >
> > http://svn.haxx.se/dev/archive-2003-05/2224.shtml
> >
> > Is there a solution for this?
>
> Well, it really depends on how correct we want to be. We can't be
> 100% correct, since we can't rely on users of the Subversion libraries
> calling an initialize function, since we didn't have one in Subversion
> 1.0, and thus we can't introduce that requirement now. We can add a
> new initialization function and request that people call it, but we
> still need to work even if it wasn't called. Perhaps making the
> current sasl init function you've got public, but inserting extra
> calls to it in ra_svn before we make use of sasl code, just in case...
>
> For other examples of this sort of thing, see svn_utf_initialize,
> although that's not really the same thing, since without it we still
> work, we just work more slowly. Also svn_fs_initialize().

I just realized APR has an atomic compare-and-swap function. So
something along the lines of:

static volatile apr_uint32_t init_started = 0, init_finished = 0;

if (! apr_atomic_cas32(&init_started, 1, 0))
  {
    /* do initialization stuff */
    init_finished = 1;
  }
else
  while (! init_finished)
    ;

.. should do the trick.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Jun 19 19:10:34 2006

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.