apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@apache.org>
Subject Re: Why does apr_file_read() with !APR_XTHREAD use mutexes on Windows
Date Sat, 24 Aug 2013 07:55:39 GMT
On 24.08.2013 06:29, Ivan Zhakov wrote:
> On Sat, Aug 24, 2013 at 3:48 AM, William A. Rowe Jr.
> <wrowe@rowe-clan.net> wrote:
>> On Fri, 23 Aug 2013 18:39:35 -0500
>> "William A. Rowe Jr." <wrowe@rowe-clan.net> wrote:
>>
>>> On Sat, 24 Aug 2013 00:33:38 +0400
>>> Ivan Zhakov <ivan@visualsvn.com> wrote:
>>>
>>>> Actually Windows supports atomic seek-to-end+write: file should be
>>>> opened with FILE_APPEND_DATA access right only [1] or Offset and
>>>> OffsetHigh should be 0xFFFFFFFF if overlapped I/O is used [2].
>>>>
>>>> I'm reopening this thread because in Subversion we found case where
>>>> we need true atomic append across processes/threads. So I'm willing
>>>> to create a patch implementing atomic append on Windows. Is right
>>>> idea for APR or not? Any concerns will be very helpful.
>>>>
>>>> [1]
>>>> http://msdn.microsoft.com/en-us/library/windows/desktop/aa363778%28v=vs.85%29.aspx
>>>> [2]
>>>> http://msdn.microsoft.com/en-us/library/windows/desktop/aa365747%28v=vs.85%29.aspx
>>> IIRC the difference is that you have writev on unix to atomically
>>> write multiple buffers.  On Windows we fake writev, so your proposed
>>> atomic writes are no longer atomic.
> Subversion doesn't use writev for file I/O, so implementing atomic
> writes is enough for our case.

Would that mean that writev on Windows uses a mutex while plain write
does not? How do you avoid a race between write and writev then?

-- Brane


Mime
View raw message