Hello Vladimir,

On Sunday, November 18, 2018, Vladimir Sitnikov <[email protected]>
wrote:
>
>
> In this case that contract is provided by JLS "17.4.3. Programs and
> Program Order" and "17.4.5. Happens-before Order" .
> TL;DR: "If x and y are actions of the same thread and x comes before y in
> program order, then hb(x, y)."
>
> I don't read the paragraph the same way 😁
For me 17.4.3 explains that action should keep order to be consistent with
program order and further more than data dependency should remain. Example
is given regarding writes and reads for the same location or variable.

Also you miss this in 17.4.5:
It should be noted that the presence of a *happens-before* relationship
between two actions does not necessarily imply that they have to take place
in that order in an implementation.

In your example, there is a write to value but no read of this value inside
the same thread, so the write is free to be reordered.

Regarding CHM, there is happens before between put and get but no
synchronize with.
So for me the write can be reordered after the put without changing program
order semantic.

But maybe I am wrong too...


>
>
> Vladimir
>
> --
> You received this message because you are subscribed to the Google Groups
> "mechanical-sympathy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to