summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2008-12-08 17:14:08 -0800
committerRuss Cox <rsc@golang.org>2008-12-08 17:14:08 -0800
commitd2fca3dd264a872b047fce494033f891f0c4bda4 (patch)
tree1586db2616bd16b5706abe46979862cb89d0ace8 /src
parentbba50f053aed134c587d434c7ac104d5599f8caf (diff)
downloadgolang-d2fca3dd264a872b047fce494033f891f0c4bda4.tar.gz
use Note sched.stopped correctly
R=r DELTA=6 (5 added, 0 deleted, 1 changed) OCL=20777 CL=20779
Diffstat (limited to 'src')
-rw-r--r--src/runtime/proc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/proc.c b/src/runtime/proc.c
index 6e947c5f5..68d06788e 100644
--- a/src/runtime/proc.c
+++ b/src/runtime/proc.c
@@ -59,6 +59,7 @@ struct Sched {
int32 predawn; // running initialization, don't run new gs.
Note stopped; // one g can wait here for ms to stop
+ int32 waitstop; // after setting this flag
};
Sched sched;
@@ -352,7 +353,10 @@ nextgandunlock(void)
throw("all goroutines are asleep - deadlock!");
m->nextg = nil;
noteclear(&m->havenextg);
- notewakeup(&sched.stopped);
+ if(sched.waitstop) {
+ sched.waitstop = 0;
+ notewakeup(&sched.stopped);
+ }
unlock(&sched);
notesleep(&m->havenextg);
@@ -376,6 +380,7 @@ stoptheworld(void)
sched.mcpumax = 1;
while(sched.mcpu > 1) {
noteclear(&sched.stopped);
+ sched.waitstop = 1;
unlock(&sched);
notesleep(&sched.stopped);
lock(&sched);