bitmap unlock bugfix

This commit is contained in:
siddontang 2014-09-01 08:33:35 +08:00
parent 882e20a3e3
commit d94f4629c2
1 changed files with 1 additions and 1 deletions

View File

@ -506,6 +506,7 @@ func (db *DB) BSetBit(key []byte, offset int32, val uint8) (ori uint8, err error
if setBit(segment, off, val) { if setBit(segment, off, val) {
t := db.binBatch t := db.binBatch
t.Lock() t.Lock()
defer t.Unlock()
t.Put(bk, segment) t.Put(bk, segment)
if _, _, e := db.bUpdateMeta(t, key, seq, off); e != nil { if _, _, e := db.bUpdateMeta(t, key, seq, off); e != nil {
@ -514,7 +515,6 @@ func (db *DB) BSetBit(key []byte, offset int32, val uint8) (ori uint8, err error
} }
err = t.Commit() err = t.Commit()
t.Unlock()
} }
} }