Merge pull request #790 from LK4D4/fix_race
bitseq: fix race between CopyTo and set
This commit is contained in:
commit
6f3c0e34f3
|
@ -250,8 +250,12 @@ func (h *Handle) set(ordinal, start, end uint64, any bool, release bool) (uint64
|
||||||
)
|
)
|
||||||
|
|
||||||
for {
|
for {
|
||||||
if h.store != nil {
|
var store datastore.DataStore
|
||||||
if err := h.store.GetObject(datastore.Key(h.Key()...), h); err != nil && err != datastore.ErrKeyNotFound {
|
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
|
return ret, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue