1
0
mirror of https://github.com/golang/go synced 2024-11-24 16:50: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:
Dmitriy Vyukov 2012-01-16 11:11:58 +04:00
parent 8727b11dfb
commit 3d2e75cf92

View File

@ -83,14 +83,15 @@ func TestInotifyClose(t *testing.T) {
watcher, _ := NewWatcher()
watcher.Close()
done := false
done := make(chan bool)
go func() {
watcher.Close()
done = true
done <- true
}()
time.Sleep(50 * time.Millisecond)
if !done {
select {
case <-done:
case <-time.After(50 * time.Millisecond):
t.Fatal("double Close() test failed: second Close() call didn't return")
}