mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
runtime: fix false positive deadlock when using runtime.Goexit
Fixes #4893. Actually it's fixed by cl/7314062 (improved scheduler), just submitting the test. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/7422054
This commit is contained in:
parent
d0c11d20b8
commit
2fe840f4f6
1 changed files with 26 additions and 0 deletions
|
|
@ -91,6 +91,14 @@ func TestLockedDeadlock2(t *testing.T) {
|
||||||
testDeadlock(t, lockedDeadlockSource2)
|
testDeadlock(t, lockedDeadlockSource2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestGoexitDeadlock(t *testing.T) {
|
||||||
|
got := executeTest(t, goexitDeadlockSource, nil)
|
||||||
|
want := ""
|
||||||
|
if got != want {
|
||||||
|
t.Fatalf("expected %q, but got %q", want, got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const crashSource = `
|
const crashSource = `
|
||||||
package main
|
package main
|
||||||
|
|
||||||
|
|
@ -175,3 +183,21 @@ func main() {
|
||||||
select {}
|
select {}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
const goexitDeadlockSource = `
|
||||||
|
package main
|
||||||
|
import (
|
||||||
|
"runtime"
|
||||||
|
)
|
||||||
|
|
||||||
|
func F() {
|
||||||
|
for i := 0; i < 10; i++ {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
go F()
|
||||||
|
go F()
|
||||||
|
runtime.Goexit()
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue