[cpp-threads] Implicit Synchronization
Lawrence Crowl
lawrence.crowl at gmail.com
Tue Jul 11 22:11:44 BST 2006
On 7/11/06, Boehm, Hans <hans.boehm at hp.com> wrote:
> We currently propose to have assignment translate to a store<release>
> and conversion to the base type to translate to a load<acquire>. Thus
> double-checked locking should just work so long as the flag or pointer
> is atomic.
This statement is inconsistent with what I thought was going on.
I thought the semantics of store release were for the one variable,
not all variables. Am I wrong?
That is, given an atomic boolean guarding an integer,
global data: int x = 3; atomic<bool> b = false;
thread one: x = 4; b = true /* store release */;
thread two: while ( ! b /* load acquire */ ); int y = x;
is it that y must be four?
Similar questions apply to variables guarded by full-up locks.
--
Lawrence Crowl
More information about the cpp-threads
mailing list