aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2012-03-30 22:36:44 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-30 22:36:44 +0000
commita1552fc3ec0ea4a6b344bf5a6c779161a4c1de39 (patch)
tree3bed00c24e1b50f3d7703c633098fa654a112d46 /libgo/runtime
parent99002f83667c7c55c035fcae9c802b5608efeb30 (diff)
downloadgcc-a1552fc3ec0ea4a6b344bf5a6c779161a4c1de39.zip
gcc-a1552fc3ec0ea4a6b344bf5a6c779161a4c1de39.tar.gz
gcc-a1552fc3ec0ea4a6b344bf5a6c779161a4c1de39.tar.bz2
libgo: Update to weekly.2012-03-27 aka go1 release.
From-SVN: r186029
Diffstat (limited to 'libgo/runtime')
-rw-r--r--libgo/runtime/proc.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index dbcfa0f..9ad9f96 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -448,6 +448,11 @@ runtime_main(void)
// roots.
mstats.enablegc = 1;
+ // The deadlock detection has false negatives.
+ // Let scvg start up, to eliminate the false negative
+ // for the trivial program func main() { select{} }.
+ runtime_gosched();
+
main_main();
runtime_exit(0);
for(;;)
@@ -795,6 +800,20 @@ top:
}
// Look for deadlock situation.
+ // There is a race with the scavenger that causes false negatives:
+ // if the scavenger is just starting, then we have
+ // scvg != nil && grunning == 0 && gwait == 0
+ // and we do not detect a deadlock. It is possible that we should
+ // add that case to the if statement here, but it is too close to Go 1
+ // to make such a subtle change. Instead, we work around the
+ // false negative in trivial programs by calling runtime.gosched
+ // from the main goroutine just before main.main.
+ // See runtime_main above.
+ //
+ // On a related note, it is also possible that the scvg == nil case is
+ // wrong and should include gwait, but that does not happen in
+ // standard Go programs, which all start the scavenger.
+ //
if((scvg == nil && runtime_sched.grunning == 0) ||
(scvg != nil && runtime_sched.grunning == 1 && runtime_sched.gwait == 0 &&
(scvg->status == Grunning || scvg->status == Gsyscall))) {