From 683311175c83dc013030e23c4826fa95b59048ea Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Mon, 13 Jul 2015 15:23:59 -0400 Subject: [PATCH] runtime: fix race in TestChanSendBarrier Fixes race detector build. Change-Id: I8bdc78d57487580e6b5b8c415df4653a1ba69e37 Reviewed-on: https://go-review.googlesource.com/12087 Reviewed-by: Austin Clements --- src/runtime/chanbarrier_test.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/chanbarrier_test.go b/src/runtime/chanbarrier_test.go index c48fd3c965..770b850f87 100644 --- a/src/runtime/chanbarrier_test.go +++ b/src/runtime/chanbarrier_test.go @@ -54,6 +54,7 @@ func TestChanSendBarrier(t *testing.T) { func testChanSendBarrier(useSelect bool) { var wg sync.WaitGroup + var globalMu sync.Mutex outer := 100 inner := 100000 if testing.Short() { @@ -73,7 +74,9 @@ func testChanSendBarrier(useSelect bool) { } garbage = make([]byte, 1<<10) } + globalMu.Lock() global = garbage + globalMu.Unlock() }() } wg.Wait()