On Wed, Nov 30, 2016 at 10:04 AM, Daniel Fanjul
<daniel.fanjul.alcu...@gmail.com> wrote:
>
> I still don't understand this issue completely.
>
> Sure, the call to wg.Done() will "happen before" wg.Wait() finishes, but the
> assignment "result = &foo{1}" might still happen concurrently.
>
> I think the problem is the semantics of the defer and the discussion is
> reduced completely to the question: is the assignment "result = &foo{1}"
> going to *happen before" the deferred called to "wg.Done()"?

I am asserting that the wg.Done is a store-release and the wg.Wait is
a load-acquire.


> I don't see any occurrence of 'defer' in https://golang.org/ref/mem nor a
> proper description in https://golang.org/ref/spec#Defer_statements, so I
> feel inclined to conclude this behavior is undefined by the spec.

I don't see why the spec needs to say anything beyond what it already
says about defer statements.

What kind of statement do you think needs to be added?

Ian

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to