[cpp-threads] RE: volatile, memory models, threads
Peter Dimov
pdimov at mmltd.net
Thu Mar 2 21:17:38 GMT 2006
Nick Maclaren wrote:
> "Peter Dimov" <pdimov at mmltd.net> wrote:
>>
>> 2. making "atomic" a (non cv-) qualifier that can't be added
>> implicitly, can be casted away relatively safely, and can possibly
>> be added via a cast relatively unsafely.
>
> The weakness of that is you then have to define ordering semantics
> between atomic and non-atomic accesses to the same object. It
> doesn't help if you forbid it, because you have to defined WHAT
> you are forbidding.
It seems to me that we have to define it in either case, because we want to
allow races if
1. both operations are reads
2. both operations are atomics
and disallow everything else. So outlawing write+read and write+write will
automatically take care of atomic_write+read, write+atomic_read,
atomic_write+write.
More information about the cpp-threads
mailing list