1
0
mirror of https://github.com/golang/go synced 2024-11-15 00:20:30 -07:00
Change-Id: Iad9d831d7b69427671d8327949a81b3c06794e11
This commit is contained in:
qiulaidongfeng 2024-05-04 15:20:23 +08:00
parent 3cbfd3c119
commit 54c3c82269

View File

@ -54,8 +54,6 @@ func TestChanSendBarrier(t *testing.T) {
testChanSendBarrier(false)
}
var globalMu sync.Mutex
func testChanSendBarrier(useSelect bool) {
var wg sync.WaitGroup
outer := 100
@ -75,12 +73,15 @@ func testChanSendBarrier(useSelect bool) {
if !ok {
panic(1)
}
garbage = make([]byte, 1<<10)
garbage = makeByte()
}
globalMu.Lock()
global = garbage
globalMu.Unlock()
_ = garbage
}()
}
wg.Wait()
}
//go:noinline
func makeByte() []byte {
return make([]byte, 1<<10)
}