here is the code:
package main

import "fmt"

func main() {
counter := 0
ch := make(chan struct{}, 1)
closeCh := make(chan struct{})
go func() {
counter++     //(1)
ch <- struct{}{}
}()
go func() {
_ = <-ch
fmt.Println(counter) //(2)
close(closeCh)
}()
_ =<-closeCh
}

is (1) happens before (2)? why?

-- 
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/5b0143e2-196e-4d73-a3e4-58a84339f433n%40googlegroups.com.

Reply via email to