summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikio Hara <mikioh.mikioh@gmail.com>2012-03-27 13:05:17 +0900
committerMikio Hara <mikioh.mikioh@gmail.com>2012-03-27 13:05:17 +0900
commit1aebcb4fc9b13156f44945a4658961c6be358af2 (patch)
tree22f16dc7d9e4411755998f043a63d7f8d606f307
parentfbedc27b46d1d5c604b58092ab4fe45a68e9a13a (diff)
downloadgo-1aebcb4fc9b13156f44945a4658961c6be358af2.tar.gz
undo CL 5844051 / 5d0322034aa8
Breaks closure test when GOMAXPROCS=2 or more. ??? original CL description runtime: restore deadlock detection in the simplest case. Fixes issue 3342. R=iant, r, dave, rsc CC=golang-dev, remy http://codereview.appspot.com/5844051 Committer: Russ Cox <rsc@golang.org> ??? R=rsc CC=golang-dev http://codereview.appspot.com/5924045
-rw-r--r--src/pkg/runtime/mheap.c3
-rw-r--r--src/pkg/runtime/proc.c19
-rw-r--r--test/fixedbugs/bug429.go13
-rw-r--r--test/golden.out3
4 files changed, 5 insertions, 33 deletions
diff --git a/src/pkg/runtime/mheap.c b/src/pkg/runtime/mheap.c
index 9dd50835e..c877bfca9 100644
--- a/src/pkg/runtime/mheap.c
+++ b/src/pkg/runtime/mheap.c
@@ -358,9 +358,6 @@ runtime·MHeap_Scavenger(void)
h = &runtime·mheap;
for(k=0;; k++) {
- // Return to the scheduler in case the rest of the world is deadlocked.
- runtime·gosched();
-
runtime·noteclear(&note);
runtime·entersyscall();
runtime·notetsleep(&note, tick);
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 509d8208c..962f748ce 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -521,16 +521,6 @@ mnextg(M *m, G *g)
}
}
-// Check for a deadlock situation.
-static void
-checkdeadlock(void) {
- if((scvg == nil && runtime·sched.grunning == 0) ||
- (scvg != nil && runtime·sched.grunning == 1 && runtime·sched.gwait == 0 &&
- (scvg->status == Grunnable || scvg->status == Grunning || scvg->status == Gsyscall))) {
- runtime·throw("all goroutines are asleep - deadlock!");
- }
-}
-
// Get the next goroutine that m should run.
// Sched must be locked on entry, is unlocked on exit.
// Makes sure that at most $GOMAXPROCS g's are
@@ -580,9 +570,6 @@ top:
continue;
}
runtime·sched.grunning++;
- // The work could actually have been the sole scavenger
- // goroutine. Look for deadlock situation.
- checkdeadlock();
schedunlock();
return gp;
}
@@ -604,7 +591,11 @@ top:
}
// Look for deadlock situation.
- checkdeadlock();
+ if((scvg == nil && runtime·sched.grunning == 0) ||
+ (scvg != nil && runtime·sched.grunning == 1 && runtime·sched.gwait == 0 &&
+ (scvg->status == Grunning || scvg->status == Gsyscall))) {
+ runtime·throw("all goroutines are asleep - deadlock!");
+ }
m->nextg = nil;
m->waitnextg = 1;
diff --git a/test/fixedbugs/bug429.go b/test/fixedbugs/bug429.go
deleted file mode 100644
index 991a37137..000000000
--- a/test/fixedbugs/bug429.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// $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 376af8e53..764f56196 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -15,9 +15,6 @@
== fixedbugs/
-=========== fixedbugs/bug429.go
-throw: all goroutines are asleep - deadlock!
-
== bugs/
=========== bugs/bug395.go