fix conditions
This commit is contained in:
parent
d3877a13e5
commit
669faec71c
1 changed files with 4 additions and 4 deletions
|
@ -67,8 +67,8 @@ func TestKeyLock_DeadlockFree(t *testing.T) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
locked, unlock := l.LockKeys(keys, nil)
|
cancelled, unlock := l.LockKeys(keys, nil)
|
||||||
if !locked {
|
if cancelled {
|
||||||
t.Error("spurious lock failure")
|
t.Error("spurious lock failure")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -100,8 +100,8 @@ func TestKeyLock_SingleKeyStress(t *testing.T) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
|
|
||||||
for i := 0; i < N; i++ {
|
for i := 0; i < N; i++ {
|
||||||
locked, unlock := l.LockKeys([]string{"a"}, timeout(time.Millisecond))
|
cancelled, unlock := l.LockKeys([]string{"a"}, timeout(time.Millisecond))
|
||||||
if locked {
|
if !cancelled {
|
||||||
unlock()
|
unlock()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue