Why wouldn't it?

> If the effect of an atomic operation A is observed by atomic operation B,
> then A is synchronized before B.

To me, it seems pretty clear that it will. Line 13 is synchronized before
line 14, which is synchronized before any load observing its effects (i.e.
any execution of line 18 which runs into the branch) - and such a load is
synchronized before the load in line 20.

Therefore, the store in Line 13 is synchronized before the load in line 20.


On Mon, Aug 15, 2022 at 8:37 AM tapi...@gmail.com <tapir....@gmail.com>
wrote:

> By the latest version of Go Memory Model article: https://go.dev/ref/mem,
> will the following program always print 1?
>
> https://go.dev/play/p/RICYGip5y8M
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/4d9b8130-d06c-4519-9b99-d161e922d8f6n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/4d9b8130-d06c-4519-9b99-d161e922d8f6n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAEkBMfHpwchwjAMtXNtpVmhb42Ncw9ENKhz5xH9Sv1z_-DMrRA%40mail.gmail.com.

Reply via email to