From 74e64d3a4625a9b5f62f4557b4a031bd60c862a4 Mon Sep 17 00:00:00 2001 From: Dinu B <32189942+dvinubius@users.noreply.github.com> Date: Wed, 23 Nov 2022 21:50:12 +0200 Subject: [PATCH] Preserve intended logic in atomics/rage/main.go the first 3 routines perform addition / subtraction, not update would be useful for learning fellows to have the video updated, too (overlay comment) --- atomics/race-fixed/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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()