Commit 68331117 authored by Russ Cox's avatar Russ Cox

runtime: fix race in TestChanSendBarrier

Fixes race detector build.

Change-Id: I8bdc78d57487580e6b5b8c415df4653a1ba69e37
Reviewed-on: https://go-review.googlesource.com/12087Reviewed-by: 's avatarAustin Clements <austin@google.com>
parent 7ef6a9f3
...@@ -54,6 +54,7 @@ func TestChanSendBarrier(t *testing.T) { ...@@ -54,6 +54,7 @@ func TestChanSendBarrier(t *testing.T) {
func testChanSendBarrier(useSelect bool) { func testChanSendBarrier(useSelect bool) {
var wg sync.WaitGroup var wg sync.WaitGroup
var globalMu sync.Mutex
outer := 100 outer := 100
inner := 100000 inner := 100000
if testing.Short() { if testing.Short() {
...@@ -73,7 +74,9 @@ func testChanSendBarrier(useSelect bool) { ...@@ -73,7 +74,9 @@ func testChanSendBarrier(useSelect bool) {
} }
garbage = make([]byte, 1<<10) garbage = make([]byte, 1<<10)
} }
globalMu.Lock()
global = garbage global = garbage
globalMu.Unlock()
}() }()
} }
wg.Wait() wg.Wait()
......
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