aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2013-03-05 09:40:17 +0200
committerDmitriy Vyukov <dvyukov@google.com>2013-03-05 09:40:17 +0200
commit2fe840f4f69bb1013ff5ae8968d8ab8257fb2d22 (patch)
treebe3ed26b5f86a8ff419e41e2bfb83f3cbdf039ca /src/pkg/runtime
parentd0c11d20b8eeebcdf2ab597c3b494e40287f9c9b (diff)
downloadgo-2fe840f4f69bb1013ff5ae8968d8ab8257fb2d22.tar.xz
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
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/crash_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/pkg/runtime/crash_test.go b/src/pkg/runtime/crash_test.go
index 5f84cb5a2f..80549a5054 100644
--- a/src/pkg/runtime/crash_test.go
+++ b/src/pkg/runtime/crash_test.go
@@ -91,6 +91,14 @@ func TestLockedDeadlock2(t *testing.T) {
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 = `
package main
@@ -175,3 +183,21 @@ func main() {
select {}
}
`
+
+const goexitDeadlockSource = `
+package main
+import (
+ "runtime"
+)
+
+func F() {
+ for i := 0; i < 10; i++ {
+ }
+}
+
+func main() {
+ go F()
+ go F()
+ runtime.Goexit()
+}
+`