1
0
mirror of https://github.com/golang/go synced 2024-11-25 12:57:58 -07:00

runtime: stop deadlock test properly (fix arm5 build)

TBR=r
CC=golang-dev
https://golang.org/cl/4446058
This commit is contained in:
Russ Cox 2011-04-22 15:22:11 -04:00
parent d5864454dc
commit 781df132f9

View File

@ -9,9 +9,15 @@ import (
"testing" "testing"
) )
var stop = make(chan bool, 1)
func perpetuumMobile() { func perpetuumMobile() {
select {
case <-stop:
default:
go perpetuumMobile() go perpetuumMobile()
} }
}
func TestStopTheWorldDeadlock(t *testing.T) { func TestStopTheWorldDeadlock(t *testing.T) {
runtime.GOMAXPROCS(3) runtime.GOMAXPROCS(3)
@ -29,4 +35,5 @@ func TestStopTheWorldDeadlock(t *testing.T) {
}() }()
go perpetuumMobile() go perpetuumMobile()
<-compl <-compl
stop <- true
} }