summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2012-03-27 12:22:19 -0400
committerRuss Cox <rsc@golang.org>2012-03-27 12:22:19 -0400
commitb61b7d5e34573d5b303e3a3f223bdb6023847fb7 (patch)
tree01f5f43cd32d4ac2100761e26a4f4693a9b23f87 /test
parentba4945a50c729cafd89ee08016a3a61ae07d1164 (diff)
downloadgo-b61b7d5e34573d5b303e3a3f223bdb6023847fb7.tar.gz
runtime: work around false negative in deadlock detection
Not a complete fix for issue 3342, but fixes the trivial case. There may still be a race in the instants before and after a scavenger-induced garbage collection. Intended to be "obviously safe": a call to runtime?gosched before main.main is no different than a call to runtime.Gosched at the beginning of main.main, and it is (or had better be) safe to call runtime.Gosched at any point during main. Update issue 3342. R=iant CC=golang-dev http://codereview.appspot.com/5919052
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/bug429.go13
-rw-r--r--test/golden.out3
2 files changed, 16 insertions, 0 deletions
diff --git a/test/fixedbugs/bug429.go b/test/fixedbugs/bug429.go
new file mode 100644
index 000000000..c1bd1d4bb
--- /dev/null
+++ b/test/fixedbugs/bug429.go
@@ -0,0 +1,13 @@
+// $G $D/$F.go && $L $F.$A && ! ./$A.out || echo BUG: bug429
+
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Should print deadlock message, not hang.
+
+package main
+
+func main() {
+ select {}
+}
diff --git a/test/golden.out b/test/golden.out
index 764f56196..376af8e53 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -15,6 +15,9 @@
== fixedbugs/
+=========== fixedbugs/bug429.go
+throw: all goroutines are asleep - deadlock!
+
== bugs/
=========== bugs/bug395.go