mirror of
https://github.com/wahyd4/knowledge.git
synced 2026-08-09 05:06:28 +10:00
add thread save map tips in go
This commit is contained in:
+8
-1
@@ -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: <https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop>
|
||||
|
||||
* gore <https://github.com/motemen/gore>
|
||||
* gore <https://github.com/motemen/gore>
|
||||
|
||||
Reference in New Issue
Block a user