aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbluefoxah <bluefoxah@gmail.com>2016-04-11 15:53:59 +0800
committerbluefoxah <bluefoxah@gmail.com>2016-04-11 15:53:59 +0800
commitc67aee701270c6ca1889c82be03ccbf010c1882b (patch)
tree3401c1f59e97737ce65e18c661e8c4677c5de283
parent112e2c69226ca94a4b9fc78ccdfbf53b46a8f3e1 (diff)
downloadseaweedfs-c67aee701270c6ca1889c82be03ccbf010c1882b.tar.xz
seaweedfs-c67aee701270c6ca1889c82be03ccbf010c1882b.zip
modify the lock
It seems that we did not use the feture of rwlock now. delete the sync.Mutex only use sync.RWMutex.
-rw-r--r--go/util/concurrent_read_map.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/go/util/concurrent_read_map.go b/go/util/concurrent_read_map.go
index 41cce8b82..ca1109f22 100644
--- a/go/util/concurrent_read_map.go
+++ b/go/util/concurrent_read_map.go
@@ -8,7 +8,6 @@ import (
// initialize the map entries.
type ConcurrentReadMap struct {
rmutex sync.RWMutex
- mutex sync.Mutex
Items map[string]interface{}
}
@@ -17,8 +16,8 @@ func NewConcurrentReadMap() *ConcurrentReadMap {
}
func (m *ConcurrentReadMap) initMapEntry(key string, newEntry func() interface{}) (value interface{}) {
- m.mutex.Lock()
- defer m.mutex.Unlock()
+ m.rmutex.Lock()
+ defer m.rmutex.Unlock()
if value, ok := m.Items[key]; ok {
return value
}