mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: make a test more robust
The issue is discovered during testing of a change to runtime. Even if it is unlikely to happen, the comment can safe an hour next person who hits it. LGTM=khr R=golang-codereviews, khr CC=golang-codereviews, rlh, rsc https://golang.org/cl/116790043
This commit is contained in:
parent
8422d1ea65
commit
387c1c661f
1 changed files with 4 additions and 0 deletions
|
|
@ -101,6 +101,10 @@ func TestGoroutineParallelism(t *testing.T) {
|
||||||
N = 3
|
N = 3
|
||||||
}
|
}
|
||||||
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P))
|
defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(P))
|
||||||
|
// If runtime triggers a forced GC during this test then it will deadlock,
|
||||||
|
// since the goroutines can't be stopped/preempted.
|
||||||
|
// So give this test as much time as possible.
|
||||||
|
runtime.GC()
|
||||||
for try := 0; try < N; try++ {
|
for try := 0; try < N; try++ {
|
||||||
done := make(chan bool)
|
done := make(chan bool)
|
||||||
x := uint32(0)
|
x := uint32(0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue