Again, the issue for the mm is https://github.com/golang/go/issues/5045 
<https://github.com/golang/go/issues/5045> but if you read the comments it 
appears the the de-facto standard is that the atomics do provide “happens 
before”, but it is not specified that this has to be the case.

> On Nov 11, 2019, at 8:02 PM, burak serdar <bser...@computer.org> wrote:
> 
> On Sun, Nov 10, 2019 at 7:08 AM Lars Seipel <lars.sei...@gmail.com> wrote:
>> 
>> On Sat, Nov 09, 2019 at 11:00:04AM -0600, Robert Engels wrote:
>>> No. Because in the absence on a memory barrier the writes may not be 
>>> flushed meaning you cannot reason about any value ever being changed.  
>>> atomics provide the memory barrier, but the mm still does not specify a 
>>> “happens before” relationship (but without this they are fairly useless).
>> 
>> Visibility is implied by the definition of "no concurrent access".
>> 
>> This case is fully handled by the current memory model:
> 
> 
> You cannot define a "happens-before" relationship using only atomics
> with the current memory model. The happens-before relationship, the
> way it is written, relies on one goroutine blocking until the other
> comes to a point where "things happen" before the block is released.
> There is no blocking with atomics, hence there is no point in time
> where one goroutine can be sure of things happened in the other
> goroutine.
> 
> The only guarantee with atomics is that when one goroutine reads a
> value, it will read the last written value. There are no guarantees on
> other values. According to the mm, things that happened before that
> final write may not be observable to other goroutines.
> 
> 
> 
>> 
>>> Also, if e1 does not happen before e2 and does not happen after e2, then
>>> we say that e1 and e2 happen concurrently.
>> 
>> […]
>> 
>>> That is, r is guaranteed to observe w if both of the following hold:
>>> 
>>> 1. w happens before r.
>>> 2. Any other write to the shared variable v either happens before w or 
>>> after r.
>> [https://golang.org/ref/mem#tmp_2]
>> 
>> --
>> 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/20191110140757.GB83577%40horsthansen.slrz.net.

-- 
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/439AC344-C698-4281-87BB-8C33839FB6C5%40ix.netcom.com.

Reply via email to