mirror of
https://github.com/gotoeasy/glogcenter.git
synced 2025-09-15 12:58:34 +08:00
修复:锁
This commit is contained in:
parent
4a086d2751
commit
8cd41041cd
@ -142,16 +142,18 @@ func (s *WordIndexStorage) Close() {
|
||||
return
|
||||
}
|
||||
|
||||
s.mu.Lock() // 锁
|
||||
s.mu.Lock() // 对象锁
|
||||
if s.closing {
|
||||
s.mu.Unlock() // 解锁
|
||||
s.mu.Unlock() // 对象解锁
|
||||
return
|
||||
}
|
||||
|
||||
s.closing = true
|
||||
s.leveldb.Close() // 走到这里时没有db操作了,可以关闭
|
||||
idxMu.Lock() // map锁
|
||||
mapWordIndexStorage[s.storeName] = nil // 设空,下回GetStorage时自动再创建
|
||||
s.mu.Unlock() // 解锁
|
||||
idxMu.Unlock() // map解锁
|
||||
s.mu.Unlock() // 对象解锁
|
||||
|
||||
log.Println("关闭WordIndexStorage:", s.storeName+cmn.PathSeparator()+s.subPath)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user