Summarizing various conversations I've seen:
The Go Memory Model says that "synchronization primitives" are in the sync and
sync/atomic packages. It also says that a "synchronization mechanism"
establishes relative ordering as observed by another goroutine. In other
words, Go's atomics are full memory barriers/fences which guarantee sequential
consistency for any number of goroutines.
John
John Souvestre - New Orleans LA
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Dave Cheney
Sent: 2017 October 22, Sun 15:22
To: golang-nuts
Subject: Re: [go-nuts] will the following code always print two 1?
Nope, as I understand it atomic load and store are not memory fencing
operations.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.