On Friday 14 April 2006 14:23, Jeff Trawick wrote:
> On 4/14/06, Nick Kew <[EMAIL PROTECTED]> wrote:
> > On Friday 14 April 2006 12:27, Jeff Trawick wrote:
> > > On 4/14/06, Bojan Smojver <[EMAIL PROTECTED]> wrote:
> > > > On Thu, 2006-04-13 at 05:16 -0400, Craig Rodrigues wrote:
> > > > > I'm trying to update the FreeBSD port of apr to use this.
> > > > >
> > > > > Can the following patch go in? Older FreeBSD versions
> > > > > like to have apr compiled with no thread support.
> > > >
> > > > I didn't actually compile this, but it looks OK to me.
> > >
> > > Same here... dbd guru anywhere?
> >
> > There's a better patch in /trunk/. But I guess that can go in 1.2.x.
>
> no need for dueling patches ;) we just backport the trunk patch if it
> fits (maybe I can look at that tomorrow)...
I did look at it with reference to the recent apr_dbd_init change.
It does a little more than just the #ifdef. If we backport that patch,
we should really backport some other stuff with it.
The story is this. I noticed various drivers each created their own
mutexes, and had the same mutex-management code, including
#ifdef hackery (APR_HAS_THREADS and APR_DSO_BUILD).
It seemed sensible to collect that in one place. So I did that by
exporting the apr_dbd mutex for use by drivers. And by putting the
conditional stuff into apr_dbd, so that drivers can dispense with
the #ifdefs.
The core of the code in Trunk is:
#if APR_HAS_THREADS
static apr_thread_mutex_t* mutex = NULL;
apr_status_t apr_dbd_mutex_lock()
{
return apr_thread_mutex_lock(mutex);
}
apr_status_t apr_dbd_mutex_unlock()
{
return apr_thread_mutex_unlock(mutex);
}
#else
apr_status_t apr_dbd_mutex_lock() {
return APR_SUCCESS;
}
apr_status_t apr_dbd_mutex_unlock() {
return APR_SUCCESS;
}
#endif
with the accessor functions being defined in the private API
(for drivers), but not in the public API for applications.
--
Nick Kew