mirror of
https://github.com/golang/go
synced 2024-11-24 16:20:13 -07:00
exp/inotify: fix data race in linux tests
Fixes #2708. R=golang-dev, bradfitz CC=golang-dev, mpimenov https://golang.org/cl/5543060
This commit is contained in:
parent
8727b11dfb
commit
3d2e75cf92
@ -83,14 +83,15 @@ func TestInotifyClose(t *testing.T) {
|
|||||||
watcher, _ := NewWatcher()
|
watcher, _ := NewWatcher()
|
||||||
watcher.Close()
|
watcher.Close()
|
||||||
|
|
||||||
done := false
|
done := make(chan bool)
|
||||||
go func() {
|
go func() {
|
||||||
watcher.Close()
|
watcher.Close()
|
||||||
done = true
|
done <- true
|
||||||
}()
|
}()
|
||||||
|
|
||||||
time.Sleep(50 * time.Millisecond)
|
select {
|
||||||
if !done {
|
case <-done:
|
||||||
|
case <-time.After(50 * time.Millisecond):
|
||||||
t.Fatal("double Close() test failed: second Close() call didn't return")
|
t.Fatal("double Close() test failed: second Close() call didn't return")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user