Return-Path: X-Original-To: apmail-apr-commits-archive@www.apache.org Delivered-To: apmail-apr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C869D10E37 for ; Mon, 21 Oct 2013 12:57:49 +0000 (UTC) Received: (qmail 24063 invoked by uid 500); 21 Oct 2013 12:57:33 -0000 Delivered-To: apmail-apr-commits-archive@apr.apache.org Received: (qmail 23567 invoked by uid 500); 21 Oct 2013 12:57:28 -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 23413 invoked by uid 99); 21 Oct 2013 12:57:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2013 12:57:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Oct 2013 12:57:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 7F0C7238899C; Mon, 21 Oct 2013 12:57:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1534139 - in /apr/apr/branches/1.5.x: ./ CHANGES file_io/win32/readwrite.c Date: Mon, 21 Oct 2013 12:57:05 -0000 To: commits@apr.apache.org From: trawick@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131021125705.7F0C7238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: trawick Date: Mon Oct 21 12:57:05 2013 New Revision: 1534139 URL: http://svn.apache.org/r1534139 Log: Merge r960671 from trunk: Only deal with the mutex when XTHREAD is enabled. This increases the performance of buffered reads/writes tremendously. * file_io/win32/readwrite.c: (apr_file_read, apr_file_write): only manipulate mutex when XTHREAD Submitted by: Ivan Zhakov Modified: apr/apr/branches/1.5.x/ (props changed) apr/apr/branches/1.5.x/CHANGES apr/apr/branches/1.5.x/file_io/win32/readwrite.c Propchange: apr/apr/branches/1.5.x/ ------------------------------------------------------------------------------ Merged /apr/apr/trunk:r960671 Modified: apr/apr/branches/1.5.x/CHANGES URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/CHANGES?rev=1534139&r1=1534138&r2=1534139&view=diff ============================================================================== --- apr/apr/branches/1.5.x/CHANGES [utf-8] (original) +++ apr/apr/branches/1.5.x/CHANGES [utf-8] Mon Oct 21 12:57:05 2013 @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes for APR 1.5.0 + *) Windows: Don't obtain a mutex for buffered file I/O unless the + file was opened with the APR_FOPEN_XTHREAD flag. [Ivan Zhakov + ] + *) Windows: Create named shared memory segments under the "Local" namespace if the caller is unprivileged, fixing an inability of unprivileged callers to use apr_shm_create() with named shared Modified: apr/apr/branches/1.5.x/file_io/win32/readwrite.c URL: http://svn.apache.org/viewvc/apr/apr/branches/1.5.x/file_io/win32/readwrite.c?rev=1534139&r1=1534138&r2=1534139&view=diff ============================================================================== --- apr/apr/branches/1.5.x/file_io/win32/readwrite.c (original) +++ apr/apr/branches/1.5.x/file_io/win32/readwrite.c Mon Oct 21 12:57:05 2013 @@ -181,12 +181,16 @@ APR_DECLARE(apr_status_t) apr_file_read( apr_size_t blocksize; apr_size_t size = *len; - apr_thread_mutex_lock(thefile->mutex); + if (thefile->flags & APR_FOPEN_XTHREAD) { + apr_thread_mutex_lock(thefile->mutex); + } if (thefile->direction == 1) { rv = apr_file_flush(thefile); if (rv != APR_SUCCESS) { - apr_thread_mutex_unlock(thefile->mutex); + if (thefile->flags & APR_FOPEN_XTHREAD) { + apr_thread_mutex_unlock(thefile->mutex); + } return rv; } thefile->bufpos = 0; @@ -223,7 +227,10 @@ APR_DECLARE(apr_status_t) apr_file_read( if (*len) { rv = APR_SUCCESS; } - apr_thread_mutex_unlock(thefile->mutex); + + if (thefile->flags & APR_FOPEN_XTHREAD) { + apr_thread_mutex_unlock(thefile->mutex); + } } else { /* Unbuffered i/o */ apr_size_t nbytes; @@ -260,7 +267,9 @@ APR_DECLARE(apr_status_t) apr_file_write apr_size_t blocksize; apr_size_t size = *nbytes; - apr_thread_mutex_lock(thefile->mutex); + if (thefile->flags & APR_FOPEN_XTHREAD) { + apr_thread_mutex_lock(thefile->mutex); + } if (thefile->direction == 0) { /* Position file pointer for writing at the offset we are logically reading from */ @@ -286,7 +295,9 @@ APR_DECLARE(apr_status_t) apr_file_write size -= blocksize; } - apr_thread_mutex_unlock(thefile->mutex); + if (thefile->flags & APR_FOPEN_XTHREAD) { + apr_thread_mutex_unlock(thefile->mutex); + } return rv; } else { if (!thefile->pipe) {