[Python-Dev] PEP 203 Augmented Assignment

Tim Peters tim_one@email.msn.com
Thu, 27 Jul 2000 13:17:22 -0400

> ...
> Note that C doesn't guarantee that a++ is atomic either, even if a is
> declared volatile.

For people who don't know, or may have forgotten, threads are not a part of
std C or C++:  those languages say nothing whatsoever about behavior in the
presence of threads.  And this is still true in C99!  ANSI/ISO committees
work by consensus, and there are so many goofy thread models out there
consensus will never be reached (keep that in mind as you ponder how PEPs
should proceed <0.6 wink>).

> (I believe there's an atomic data type, but I don't think it
> guarantees atomic ++.

You may be thinking of sig_atomic_t?  That relates to a technical meaning
for "atomic" in signal handlers, a meaning that has nothing to do with
threads.  In effect, sig_atomic_t is simply a volatile integral type small
enough so that read and write each take one machine instruction (so, e.g., a
64-bit int would not serve as a suitable sig_atomic_t on a 32-bit machine,
as it would have to be read and written "in pieces", and an interrupting
signal could cause an interrupted read or write to use inconsistent pieces).