From 43555f9a77143512d00e980ef5853a577a2d3592 Mon Sep 17 00:00:00 2001 From: Kenneth Yang Date: Mon, 15 Jul 2024 14:55:19 -0400 Subject: [PATCH] Add comments to indicate it's a bad/good example Make it more explicit that Counter/Counter2 is a bad/good example. Those without the book --- src/09-concurrency-practice/74-copying-sync/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/09-concurrency-practice/74-copying-sync/main.go b/src/09-concurrency-practice/74-copying-sync/main.go index 0a32b017..b9e5f122 100644 --- a/src/09-concurrency-practice/74-copying-sync/main.go +++ b/src/09-concurrency-practice/74-copying-sync/main.go @@ -19,7 +19,7 @@ func main() { } type Counter struct { - mu sync.Mutex + mu sync.Mutex // bad counters map[string]int } @@ -38,7 +38,7 @@ func (c *Counter) Increment2(name string) { } type Counter2 struct { - mu *sync.Mutex + mu *sync.Mutex // good counters map[string]int }