MCPcopy
hub / github.com/mao888/golang-guide / main

Function main

golang/go-study/go语言基础/并发/并发安全和锁/数据竞争示例.go:19–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19func main() {
20 wg.Add(2)
21 //runtime.GOMAXPROCS(1)
22 go add()
23 go add()
24
25 wg.Wait()
26 fmt.Println(x)
27}
28
29/*
30开启了两个 goroutine 分别执行 add 函数,

Callers

nothing calls this directly

Calls 3

addFunction · 0.70
AddMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected