From: Dmitriy Vyukov Date: Mon, 16 Jan 2012 07:11:58 +0000 (+0400) Subject: exp/inotify: fix data race in linux tests X-Git-Tag: weekly.2012-01-20~103 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=3d2e75cf922440870596e9bc6145630b2b6a3d5d;p=gostls13.git exp/inotify: fix data race in linux tests Fixes #2708. R=golang-dev, bradfitz CC=golang-dev, mpimenov https://golang.org/cl/5543060 --- diff --git a/src/pkg/exp/inotify/inotify_linux_test.go b/src/pkg/exp/inotify/inotify_linux_test.go index d035ec1410..c2160fc653 100644 --- a/src/pkg/exp/inotify/inotify_linux_test.go +++ b/src/pkg/exp/inotify/inotify_linux_test.go @@ -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") }