For #53821
Change-Id: I7e86dac34691f7752f68879ff379061f3435cd45
Reviewed-on: https://go-review.googlesource.com/c/go/+/427139
Reviewed-by: Michael Knyszek <mknyszek@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: xie cui <
523516579@qq.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
}
func TestAfterStress(t *testing.T) {
- stop := uint32(0)
+ var stop atomic.Bool
go func() {
- for atomic.LoadUint32(&stop) == 0 {
+ for !stop.Load() {
runtime.GC()
// Yield so that the OS can wake up the timer thread,
// so that it can generate channel sends for the main goroutine,
<-ticker.C
}
ticker.Stop()
- atomic.StoreUint32(&stop, 1)
+ stop.Store(true)
}
func benchmark(b *testing.B, bench func(n int)) {