Return-Path: Delivered-To: apmail-apr-bugs-archive@www.apache.org Received: (qmail 70926 invoked from network); 28 Jun 2007 11:41:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 28 Jun 2007 11:41:53 -0000 Received: (qmail 25419 invoked by uid 500); 28 Jun 2007 11:41:56 -0000 Delivered-To: apmail-apr-bugs-archive@apr.apache.org Received: (qmail 25399 invoked by uid 500); 28 Jun 2007 11:41:56 -0000 Mailing-List: contact bugs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@apr.apache.org Delivered-To: mailing list bugs@apr.apache.org Received: (qmail 25388 invoked by uid 99); 28 Jun 2007 11:41:56 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 04:41:56 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME,UPPERCASE_25_50 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 Jun 2007 04:41:52 -0700 Received: by brutus.apache.org (Postfix, from userid 33) id 6600548960C; Thu, 28 Jun 2007 04:41:32 -0700 (PDT) From: bugzilla@apache.org To: bugs@apr.apache.org Subject: DO NOT REPLY [Bug 42760] - Atomic hash_mutex overwritten on multiple calls to apr_atomic_init In-Reply-To: X-Bugzilla-Reason: AssignedTo Message-Id: <20070628114132.6600548960C@brutus.apache.org> Date: Thu, 28 Jun 2007 04:41:32 -0700 (PDT) X-Virus-Checked: Checked by ClamAV on apache.org DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG� RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT . ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND� INSERTED IN THE BUG DATABASE. http://issues.apache.org/bugzilla/show_bug.cgi?id=42760 ------- Additional Comments From tim@mr-dog.net 2007-06-28 04:41 ------- (From update of attachment 20408) >Index: apr_atomic.c >=================================================================== >--- apr_atomic.c (revision 5) >+++ apr_atomic.c (working copy) >@@ -168,7 +168,7 @@ > #define NUM_ATOMIC_HASH 7 > /* shift by 2 to get rid of alignment issues */ > #define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH) >-static apr_thread_mutex_t **hash_mutex; >+static apr_thread_mutex_t **hash_mutex = NULL; > #endif /* APR_HAS_THREADS */ > > apr_status_t apr_atomic_init(apr_pool_t *p) >@@ -176,13 +176,16 @@ > #if APR_HAS_THREADS > int i; > apr_status_t rv; >- hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH); > >- for (i = 0; i < NUM_ATOMIC_HASH; i++) { >- rv = apr_thread_mutex_create(&(hash_mutex[i]), >- APR_THREAD_MUTEX_DEFAULT, p); >- if (rv != APR_SUCCESS) { >- return rv; >+ if (hash_mutex == NULL) { >+ hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH); >+ >+ for (i = 0; i < NUM_ATOMIC_HASH; i++) { >+ rv = apr_thread_mutex_create(&(hash_mutex[i]), >+ APR_THREAD_MUTEX_DEFAULT, p); >+ if (rv != APR_SUCCESS) { >+ return rv; >+ } > } > } > #endif /* APR_HAS_THREADS */ -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org For additional commands, e-mail: bugs-help@apr.apache.org