Subject: Re: Are writes "atomic" to readers of the file?
From: [email-masked] (Jimbo Foobarcuux)
Date: 08 Mar 2011 17:04:20 GMT
Newsgroups: comp.unix.programmer

John Denver <[email-masked]> writes:
>Eric the Red wrote:
>
>>> There _IS_ a requirement that all reads and writes to regular files
>>> be atomic.   There is also an ordering guarantee.   Any implementation
>>> that doesn't provide both atomicity and ordering guarantees is broken.
>>
>> But where is it specified?
>
>The place where it is stated most explicitly is in XSH7 2.9.7
>Thread Interactions with Regular File Operations:
>
>    All of the following functions shall be atomic with respect to each
>    other in the effects specified in POSIX.1-2008 when they operate on
>    regular files or symbolic links:
>
>    [List of functions that includes read() and write()]
>
>    If two threads each call one of these functions, each call shall
>    either see all of the specified effects of the other call, or none
>    of them.
>

And, for the purposes of this paragraph, the two threads need not be
part of the same process.

jimbo