[cpp-threads] memory model

Peter Dimov pdimov at mmltd.net
Thu May 5 12:55:20 BST 2005


I have the following question about the proposed memory model:

In the examples below:

1.

    r1 = atomic_load( &x );
    r2 = y;

2.

    r1 = atomic_load( &x );
    r2 = atomic_load( &y );

3.

    if( r1 = atomic_load( &x ) )
        r2 = y;

(note that the atomic loads do not have an associated ordering constraint)

is the compiler or the hardware allowed to reorder the two loads?




More information about the cpp-threads mailing list