Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 1764 invoked from network); 10 Jun 2009 01:13:22 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Jun 2009 01:13:22 -0000 Received: (qmail 50642 invoked by uid 500); 10 Jun 2009 01:13:33 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 50549 invoked by uid 500); 10 Jun 2009 01:13:33 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 50541 invoked by uid 99); 10 Jun 2009 01:13:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2009 01:13:33 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of bojan@rexursive.com designates 150.101.121.179 as permitted sender) Received: from [150.101.121.179] (HELO beauty.rexursive.com) (150.101.121.179) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2009 01:13:25 +0000 Received: from [10.1.120.24] (shrek.rexursive.com [10.1.120.24]) by beauty.rexursive.com (Postfix) with ESMTP id 466798C012; Wed, 10 Jun 2009 11:13:04 +1000 (EST) Subject: Re: [MAINTAINER] devel/apr-gdbm-db42: apr-util 1.3.7 breaks dbd support From: Bojan Smojver To: "William A. Rowe, Jr." Cc: dev@apr.apache.org In-Reply-To: <1244595226.25532.146.camel@shrek.rexursive.com> References: <200906090316.n593GCYQ075516@frieza.p6m7g8.net> <1244520824.25532.88.camel@shrek.rexursive.com> <4A2DF79D.709@rowe-clan.net> <4A2E001E.4020806@p6m7g8.com> <1244531713.25532.95.camel@shrek.rexursive.com> <4A2E0CB8.1090701@p6m7g8.com> <1244532560.25532.103.camel@shrek.rexursive.com> <1244534466.25532.113.camel@shrek.rexursive.com> <4A2E6BA4.7040305@rowe-clan.net> <20090609152157.GA15723@redhat.com> <4A2E86A0.5080005@rowe-clan.net> <1244595226.25532.146.camel@shrek.rexursive.com> Content-Type: multipart/mixed; boundary="=-7UCYJsE3Sp0X51rVc1y4" Date: Wed, 10 Jun 2009 11:13:04 +1000 Message-Id: <1244596384.25532.150.camel@shrek.rexursive.com> Mime-Version: 1.0 X-Mailer: Evolution 2.26.2 (2.26.2-1.fc11) X-Virus-Checked: Checked by ClamAV on apache.org --=-7UCYJsE3Sp0X51rVc1y4 Content-Type: text/plain Content-Transfer-Encoding: 7bit On Wed, 2009-06-10 at 10:53 +1000, Bojan Smojver wrote: > so we can replace the int's with apr_uint32_t Just for the record. -- Bojan --=-7UCYJsE3Sp0X51rVc1y4 Content-Disposition: attachment; filename="apu-dso-init-atomic.patch" Content-Type: text/x-patch; name="apu-dso-init-atomic.patch"; charset="UTF-8" Content-Transfer-Encoding: 7bit Index: misc/apu_dso.c =================================================================== --- misc/apu_dso.c (revision 783165) +++ misc/apu_dso.c (working copy) @@ -27,6 +27,7 @@ #include "apr_hash.h" #include "apr_file_io.h" #include "apr_env.h" +#include "apr_atomic.h" #include "apu_internal.h" #include "apu_version.h" @@ -37,6 +38,7 @@ static apr_thread_mutex_t* mutex = NULL; #endif static apr_hash_t *dsos = NULL; +static apr_uint32_t initialised = 0, in_init = 1; #if APR_HAS_THREADS apr_status_t apu_dso_mutex_lock() @@ -76,7 +78,10 @@ apr_pool_t *global; apr_pool_t *parent; - if (dsos != NULL) { + if (apr_atomic_inc32(&initialised)) { + while (apr_atomic_read32(&in_init)) /* wait until we get fully inited */ + ; + return APR_SUCCESS; } @@ -94,6 +99,8 @@ apr_pool_cleanup_register(global, NULL, apu_dso_term, apr_pool_cleanup_null); + apr_atomic_dec32(&in_init); + return ret; } Index: dbm/apr_dbm.c =================================================================== --- dbm/apr_dbm.c (revision 783165) +++ dbm/apr_dbm.c (working copy) @@ -24,6 +24,7 @@ #define APR_WANT_STRFUNC #include "apr_want.h" #include "apr_general.h" +#include "apr_atomic.h" #include "apu_config.h" #include "apu.h" @@ -59,6 +60,7 @@ #if APU_DSO_BUILD static apr_hash_t *drivers = NULL; +static apr_uint32_t initialised = 0, in_init = 1; static apr_status_t dbm_term(void *ptr) { @@ -117,8 +119,11 @@ } else usertype = 1; - if (!drivers) - { + if (apr_atomic_inc32(&initialised)) { + while (apr_atomic_read32(&in_init)) /* wait until we get fully inited */ + ; + } + else { apr_pool_t *parent; /* Top level pool scope, need process-scope lifetime */ @@ -133,6 +138,8 @@ apr_pool_cleanup_register(pool, NULL, dbm_term, apr_pool_cleanup_null); + + apr_atomic_dec32(&in_init); } rv = apu_dso_mutex_lock(); --=-7UCYJsE3Sp0X51rVc1y4--