[cpp-threads] Yet another visibility question
Peter Dimov
pdimov at mmltd.net
Tue Nov 21 22:35:06 GMT 2006
Boehm, Hans wrote:
> We could disallow the thread 5 behavior by explicitly requiring that
> stores to each single atomic object x occur in a single total order
> "store-order-for-x", and that all such orders be included in the
> "happens-before" relation.
Do you mean store-releases here (ordering raw stores seems too strict)? And
if so, isn't this already the case? If it isn't, consider this example:
// thread 1
fetchadd_release( &x, 1 );
// thread 2
fetchadd_release( &x, 1 );
// thread 3
r1 = load_acquire( &x );
r2 = load_acquire( &x );
assert( r1 <= r2 );
A model in which thread 3 can see r1 == 2 and r2 == 1 would be a challenge
to explain.
More information about the cpp-threads
mailing list