How To Add a Sequence Point?
Ian Lance Taylor
iant@google.com
Mon Feb 4 04:44:00 GMT 2013
On Sat, Feb 2, 2013 at 5:10 PM, Jeffrey Walton <noloader@gmail.com> wrote:
>
> What does C/C++ and GCC offer to ensure writes are complete before
> reads are performed on a value in a multi-threaded program?
The write must be done using
__atomic_store(pointer, value, __ATOMIC_RELEASE);
The read must be done using
__atomic_load(pointer, pointer_to_value, __ATOMIC_ACQUIRE);
Or you must use other atomic operations with a similar release/acquire
sequence, or using a more strict memory model.
Ian
More information about the Gcc
mailing list