Browse Source

Added in locking

pull/1842/head
Paul W. Homer 8 years ago
parent
commit
097e0abca9
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      mem_db.go

+ 6
- 0
mem_db.go View File

@ -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…
Cancel
Save