diff options
author | Russ Cox <rsc@golang.org> | 2015-07-13 15:23:59 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2015-07-13 19:42:20 +0000 |
commit | 683311175c83dc013030e23c4826fa95b59048ea (patch) | |
tree | f72f00bba03fcbf2950b64ae3c93157c977893e6 /src/runtime/chanbarrier_test.go | |
parent | 7ef6a9f38b39bd442ad07f5faf895486a5f58750 (diff) | |
download | go-683311175c83dc013030e23c4826fa95b59048ea.tar.gz go-683311175c83dc013030e23c4826fa95b59048ea.zip |
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>
Diffstat (limited to 'src/runtime/chanbarrier_test.go')
-rw-r--r-- | src/runtime/chanbarrier_test.go | 3 |
1 files changed, 3 insertions, 0 deletions
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() |