Commit 16a59345 authored by Alex Brainman's avatar Alex Brainman

exp/winfsnotify: fix data race in TestNotifyClose

Fixes #4342.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6850080
parent b5aa4789
......@@ -9,6 +9,7 @@ package winfsnotify
import (
"io/ioutil"
"os"
"sync/atomic"
"testing"
"time"
)
......@@ -105,14 +106,14 @@ func TestNotifyClose(t *testing.T) {
watcher, _ := NewWatcher()
watcher.Close()
done := false
var done int32
go func() {
watcher.Close()
done = true
atomic.StoreInt32(&done, 1)
}()
time.Sleep(50 * time.Millisecond)
if !done {
if atomic.LoadInt32(&done) == 0 {
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