Commit 3d2e75cf authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

exp/inotify: fix data race in linux tests

Fixes #2708.

R=golang-dev, bradfitz
CC=golang-dev, mpimenov
https://golang.org/cl/5543060
parent 8727b11d
...@@ -83,14 +83,15 @@ func TestInotifyClose(t *testing.T) { ...@@ -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")
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment