Return-Path: X-Original-To: apmail-apr-dev-archive@www.apache.org Delivered-To: apmail-apr-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C5CD3107C0 for ; Mon, 26 Aug 2013 15:42:53 +0000 (UTC) Received: (qmail 27840 invoked by uid 500); 26 Aug 2013 15:42:53 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 27502 invoked by uid 500); 26 Aug 2013 15:42:52 -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 27488 invoked by uid 99); 26 Aug 2013 15:42:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Aug 2013 15:42:51 +0000 X-ASF-Spam-Status: No, hits=0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE X-Spam-Check-By: apache.org Received-SPF: error (nike.apache.org: local policy) Received: from [64.202.165.4] (HELO m1plsmtpa01-03.prod.mesa1.secureserver.net) (64.202.165.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Aug 2013 15:42:45 +0000 Received: from hub ([76.252.112.72]) by m1plsmtpa01-03.prod.mesa1.secureserver.net with id HThz1m00M1Zmh9Y01Ti0r7; Mon, 26 Aug 2013 08:42:02 -0700 Date: Mon, 26 Aug 2013 10:41:57 -0500 From: "William A. Rowe Jr." To: Ivan Zhakov Cc: Jeff Trawick , APR Developer List , Bert Huijben Subject: Re: Why does apr_file_read() with !APR_XTHREAD use mutexes on Windows Message-ID: <20130826104157.36ba1a09@hub> In-Reply-To: References: <002c01cae068$d7e5e970$87b1bc50$@qqmail.nl> <4BD5F9C8.707@rowe-clan.net> <036901cae5ee$9e68b5c0$db3a2140$@qqmail.nl> <20130826094304.602bc1f4@hub> X-Mailer: Claws Mail 3.9.0 (GTK+ 2.24.13; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org On Mon, 26 Aug 2013 18:58:21 +0400 Ivan Zhakov wrote: > Alternative solution would be take file->lock mutex on write operation > and user shared OVERLAPPED structure. Also note that MSDN states that > opening file with FILE_APPEND permissions only will perform atomic > move-to-end + write without overlapped I/O. Sure, that works for files, but apr_file_write is not strictly for true file-based handles, right? Some general thoughts... until apr_file_writev is called, we won't need the append file lock. But... we need to mutex against the parallel calls to apr_file_writev so we can't create the mutex to interlock at that moment. ... we need completion contexts with an event-per-thread ... but these do not span apr_ calls. What about parking a per-thread apr-shared completion context created on apr thread startup and the event handle closed on apr thread teardown?