Return-Path: Delivered-To: apmail-apr-commits-archive@www.apache.org Received: (qmail 58053 invoked from network); 26 Jan 2006 04:28:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Jan 2006 04:28:58 -0000 Received: (qmail 5664 invoked by uid 500); 26 Jan 2006 04:28:57 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 5642 invoked by uid 500); 26 Jan 2006 04:28:57 -0000 Mailing-List: contact commits-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: Reply-To: dev@apr.apache.org List-Id: Delivered-To: mailing list commits@apr.apache.org Received: (qmail 5631 invoked by uid 99); 26 Jan 2006 04:28:57 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Jan 2006 20:28:57 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 25 Jan 2006 20:28:56 -0800 Received: (qmail 57989 invoked by uid 65534); 26 Jan 2006 04:28:36 -0000 Message-ID: <20060126042836.57988.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r372430 - in /apr/apr/branches/1.2.x: CHANGES locks/win32/thread_rwlock.c test/testlock.c Date: Thu, 26 Jan 2006 04:28:35 -0000 To: commits@apr.apache.org From: rooneg@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: rooneg Date: Wed Jan 25 20:28:34 2006 New Revision: 372430 URL: http://svn.apache.org/viewcvs?rev=372430&view=rev Log: Merge r371172 to 1.2.x. Original log message: Fix an assert that occurs when you destroy a rwlock on win32 and later clear the pool it was allocated from. Submitted by: Evgueni Brevnov * locks/win32/thread_rwlock.c (apr_thread_rwlock_destroy): Use apr_pool_cleanup_run to call our cleanup function. (thread_rwlock_cleanup): Put the destruction of the rwlock here instead of in the destructor function. * test/testlock.c (test_thread_rwlocks): Destroy the rwlock explicitly so we can see this kind of problem. * CHANGES: Note change. Modified: apr/apr/branches/1.2.x/CHANGES apr/apr/branches/1.2.x/locks/win32/thread_rwlock.c apr/apr/branches/1.2.x/test/testlock.c Modified: apr/apr/branches/1.2.x/CHANGES URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/CHANGES?rev=372430&r1=372429&r2=372430&view=diff ============================================================================== --- apr/apr/branches/1.2.x/CHANGES (original) +++ apr/apr/branches/1.2.x/CHANGES Wed Jan 25 20:28:34 2006 @@ -2,6 +2,9 @@ *) Keep testpipe.c from hanging on win32. [Garrett Rooney] + *) Fix assertion from double close of a handle with a rwlock on win32. + [Evgueni Brevnov ] + *) Documented that apr_stat and apr_dir_read can return APR_INCOMPLETE, and how to determine which parts of the resulting apr_finfo_t can be used in such a case. Modified: apr/apr/branches/1.2.x/locks/win32/thread_rwlock.c URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/locks/win32/thread_rwlock.c?rev=372430&r1=372429&r2=372430&view=diff ============================================================================== --- apr/apr/branches/1.2.x/locks/win32/thread_rwlock.c (original) +++ apr/apr/branches/1.2.x/locks/win32/thread_rwlock.c Wed Jan 25 20:28:34 2006 @@ -23,7 +23,15 @@ static apr_status_t thread_rwlock_cleanup(void *data) { - return apr_thread_rwlock_destroy((apr_thread_rwlock_t *) data); + apr_thread_rwlock_t *rwlock = data; + + if (! CloseHandle(rwlock->read_event)) + return apr_get_os_error(); + + if (! CloseHandle(rwlock->write_mutex)) + return apr_get_os_error(); + + return APR_SUCCESS; } APR_DECLARE(apr_status_t)apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, @@ -151,13 +159,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) { - if (! CloseHandle(rwlock->read_event)) - return apr_get_os_error(); - - if (! CloseHandle(rwlock->write_mutex)) - return apr_get_os_error(); - - return APR_SUCCESS; + return apr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(thread_rwlock) Modified: apr/apr/branches/1.2.x/test/testlock.c URL: http://svn.apache.org/viewcvs/apr/apr/branches/1.2.x/test/testlock.c?rev=372430&r1=372429&r2=372430&view=diff ============================================================================== --- apr/apr/branches/1.2.x/test/testlock.c (original) +++ apr/apr/branches/1.2.x/test/testlock.c Wed Jan 25 20:28:34 2006 @@ -209,6 +209,8 @@ apr_thread_join(&s4, t4); ABTS_INT_EQUAL(tc, MAX_ITER, x); + + apr_thread_rwlock_destroy(rwlock); } static void test_cond(abts_case *tc, void *data)