Merge pull request #790 from LK4D4/fix_race
bitseq: fix race between CopyTo and set
This commit is contained in:
commit
6f3c0e34f3
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue