[Python-ideas] Async API: some code to review
Richard Oudkerk
shibturn at gmail.com
Mon Oct 29 17:41:57 CET 2012
On 29/10/2012 4:09pm, Mark Hackett wrote:
> Is that actually true? It may be guaranteed on Intel x86 compatibles and Linux
> (because of the string operations available in the x86 instruction set), but I
> don't thing anything other than an IPC message has a "you can write a string
> atomically" guarantee. And I may be misremembering that.
The guarantee I was talking about is for pipes on Unix:
<quote>
POSIX.1-2001 says that write(2)s of less than PIPE_BUF bytes must be
atomic: the output data is written to the pipe as a contiguous sequence.
Writes of more than PIPE_BUF bytes may be nonatomic: the kernel may
interleave the data with data written by other processes. POSIX.1-2001
requires PIPE_BUF to be at least 512 bytes. (On Linux, PIPE_BUF is 4096
bytes.) ...
</quote>
On Windows writes to pipes in message oriented mode are also atomic.
> And even if it's part of the SUS, how do we know this is true for non-UNIX
> compatible systems?
We don't, but that isn't necessarily a reason to ban it as evil.
--
Richard
More information about the Python-ideas
mailing list