Added in locking
This commit is contained in:
parent
6064c80250
commit
097e0abca9
|
@ -78,6 +78,9 @@ type memDBIterator struct {
|
|||
}
|
||||
|
||||
func (it *memDBIterator) Create(db *MemDB) *memDBIterator {
|
||||
db.mtx.Lock()
|
||||
defer db.mtx.Unlock()
|
||||
|
||||
if it == nil {
|
||||
it = &memDBIterator{}
|
||||
}
|
||||
|
@ -104,6 +107,9 @@ func (it *memDBIterator) Key() []byte {
|
|||
}
|
||||
|
||||
func (it *memDBIterator) Value() []byte {
|
||||
it.db.mtx.Lock()
|
||||
defer it.db.mtx.Unlock()
|
||||
|
||||
return it.db.db[it.keys[it.last]]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue