1
0
mirror of https://github.com/golang/go synced 2024-11-20 02:54:39 -07:00

runtime: fix race in TestChanSendBarrier

Fixes race detector build.

Change-Id: I8bdc78d57487580e6b5b8c415df4653a1ba69e37
Reviewed-on: https://go-review.googlesource.com/12087
Reviewed-by: Austin Clements <austin@google.com>
This commit is contained in:
Russ Cox 2015-07-13 15:23:59 -04:00
parent 7ef6a9f38b
commit 683311175c

View File

@ -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) {
} }
garbage = make([]byte, 1<<10) garbage = make([]byte, 1<<10)
} }
globalMu.Lock()
global = garbage global = garbage
globalMu.Unlock()
}() }()
} }
wg.Wait() wg.Wait()