diff --git a/atomics/race-fixed/main.go b/atomics/race-fixed/main.go index a1020f1..23ae4ea 100644 --- a/atomics/race-fixed/main.go +++ b/atomics/race-fixed/main.go @@ -12,15 +12,15 @@ func main() { wg.Add(5) go func() { defer wg.Done() - atomic.StoreInt32(&count, 10) + atomic.AddInt32(&count, 10) }() go func() { defer wg.Done() - atomic.StoreInt32(&count, -15) + atomic.AddInt32(&count, -15) }() go func() { defer wg.Done() - atomic.StoreInt32(&count, 1) + atomic.AddInt32(&count, 1) }() go func() { defer wg.Done()