Fix rwmutex test
This commit is contained in:
parent
b47acc1e28
commit
91fdec209b
1 changed files with 2 additions and 2 deletions
|
@ -5,6 +5,7 @@ import (
|
|||
"runtime"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func parallelReader(m *RWMutex, clocked, cunlock, cdone chan bool) {
|
||||
|
@ -98,7 +99,6 @@ func HammerRWMutex(gomaxprocs, numReaders, numIterations int) {
|
|||
}
|
||||
|
||||
func TestRWMutexReadWrite(t *testing.T) {
|
||||
timeout := time.After(5 * time.Second)
|
||||
done := make(chan bool)
|
||||
go func() {
|
||||
rwm := New()
|
||||
|
@ -108,7 +108,7 @@ func TestRWMutexReadWrite(t *testing.T) {
|
|||
}()
|
||||
|
||||
select {
|
||||
case <-timeout:
|
||||
case <-time.After(time.Second):
|
||||
case <-done:
|
||||
t.Fatal("Test finished, must be deadlock")
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue