Skip to content

Commit 3b3aaa2

Browse files
committed
you're doing great
1 parent e67e348 commit 3b3aaa2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

22_go-routines/08_atomicity/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func incrementor(s string) {
2323
for i := 0; i < 20; i++ {
2424
time.Sleep(time.Duration(rand.Intn(3)) * time.Millisecond)
2525
atomic.AddInt64(&counter, 1)
26-
fmt.Println(s, i, "Counter:", atomic.LoadInt64(&counter))
26+
fmt.Println(s, i, "Counter:", atomic.LoadInt64(&counter)) // access without race
2727
}
2828
wg.Done()
2929
}

0 commit comments

Comments
 (0)