From 20830287e0ea1841897d8d546c8d421bbff46a52 Mon Sep 17 00:00:00 2001 From: Junwei Zhao Date: Mon, 24 Dec 2018 14:29:33 +1100 Subject: [PATCH] add thread save map tips in go --- categories/go.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/categories/go.md b/categories/go.md index da6b856..bcaaa74 100644 --- a/categories/go.md +++ b/categories/go.md @@ -67,6 +67,13 @@ ch := make(chan Task, 3) \`aaa bbb ccc\` - panic / recover +- `sync.Map` is concurrent/ thread safe `map`, normal `map` isn't + +```go +m := new(sync.Map) +m.Store("a", "b") +value, ok := m.Load("a") +``` # Frameworks @@ -199,4 +206,4 @@ REPL stands for read eval print loop, basically it just like the irb in Ruby. Wiki: -* gore \ No newline at end of file +* gore