Merge pull request #790 from LK4D4/fix_race

bitseq: fix race between CopyTo and set
This commit is contained in:
Jana Radhakrishnan 2015-11-30 14:07:12 -08:00
commit 6f3c0e34f3
1 changed files with 6 additions and 2 deletions

View File

@ -250,8 +250,12 @@ func (h *Handle) set(ordinal, start, end uint64, any bool, release bool) (uint64
)
for {
if h.store != nil {
if err := h.store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
var store datastore.DataStore
h.Lock()
store = h.store
h.Unlock()
if store != nil {
if err := store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
return ret, err
}
}