We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e67e348 commit 3b3aaa2Copy full SHA for 3b3aaa2
22_go-routines/08_atomicity/main.go
@@ -23,7 +23,7 @@ func incrementor(s string) {
23
for i := 0; i < 20; i++ {
24
time.Sleep(time.Duration(rand.Intn(3)) * time.Millisecond)
25
atomic.AddInt64(&counter, 1)
26
- fmt.Println(s, i, "Counter:", atomic.LoadInt64(&counter))
+ fmt.Println(s, i, "Counter:", atomic.LoadInt64(&counter)) // access without race
27
}
28
wg.Done()
29
0 commit comments