> Machine-sized means smaller than or equal to sizeof(long).
>
> Take a look at the implementation of WRITE_ONCE or READ_ONCE of linux.

That is not necessarily true. What sizes and alignments are guaranteed
to be atomic for access (i.e., writing a value to a memory location
results in everyone seeing either the old value or the new value,
never a mix) is defined by the hardware architecture, and need not
align with the C definition of long. You can use the C11
ATOMIC_*_LOCK_FREE() to determine if a type is atomic.

As Akira points out, the term "atomic" is overloaded, and can cause
much confusion. A type being atomic for read or write access does not
imply atomic read-modify-write.

--Elad

Reply via email to