This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How To Add a Sequence Point?
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