diff options
Diffstat (limited to 'vendor/github.com/modern-go/concurrent/go_below_19.go')
-rw-r--r-- | vendor/github.com/modern-go/concurrent/go_below_19.go | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/vendor/github.com/modern-go/concurrent/go_below_19.go b/vendor/github.com/modern-go/concurrent/go_below_19.go deleted file mode 100644 index b9c8df7..0000000 --- a/vendor/github.com/modern-go/concurrent/go_below_19.go +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | //+build !go1.9 | ||
2 | |||
3 | package concurrent | ||
4 | |||
5 | import "sync" | ||
6 | |||
7 | // Map implements a thread safe map for go version below 1.9 using mutex | ||
8 | type Map struct { | ||
9 | lock sync.RWMutex | ||
10 | data map[interface{}]interface{} | ||
11 | } | ||
12 | |||
13 | // NewMap creates a thread safe map | ||
14 | func NewMap() *Map { | ||
15 | return &Map{ | ||
16 | data: make(map[interface{}]interface{}, 32), | ||
17 | } | ||
18 | } | ||
19 | |||
20 | // Load is same as sync.Map Load | ||
21 | func (m *Map) Load(key interface{}) (elem interface{}, found bool) { | ||
22 | m.lock.RLock() | ||
23 | elem, found = m.data[key] | ||
24 | m.lock.RUnlock() | ||
25 | return | ||
26 | } | ||
27 | |||
28 | // Load is same as sync.Map Store | ||
29 | func (m *Map) Store(key interface{}, elem interface{}) { | ||
30 | m.lock.Lock() | ||
31 | m.data[key] = elem | ||
32 | m.lock.Unlock() | ||
33 | } | ||