diff options
author | Russ Cox <rsc@golang.org> | 2009-12-14 19:06:20 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-12-14 19:06:20 -0800 |
commit | 6c21be09e3da01a7bf778c7a308cf59c5fa36068 (patch) | |
tree | ec43ee578a6e7b32f21b3f57321f507bfdefdb5f /src/pkg/runtime/proc.c | |
parent | b36d7a0f0d4dc6c93b89f5d38d7617effedb9459 (diff) | |
download | golang-6c21be09e3da01a7bf778c7a308cf59c5fa36068.tar.gz |
runtime: in exitsyscall, avoid confusing garbage collector
R=r
CC=golang-dev
http://codereview.appspot.com/178046
Diffstat (limited to 'src/pkg/runtime/proc.c')
-rw-r--r-- | src/pkg/runtime/proc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index f04cb6692..e81089bfa 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -566,14 +566,19 @@ runtime·exitsyscall(void) unlock(&sched); return; } - g->status = Grunning; sched.msyscall--; sched.mcpu++; // Fast path - if there's room for this m, we're done. if(sched.mcpu <= sched.mcpumax) { + g->status = Grunning; unlock(&sched); return; } + // Tell scheduler to put g back on the run queue: + // mostly equivalent to g->status = Grunning, + // but keeps the garbage collector from thinking + // that g is running right now, which it's not. + g->readyonstop = 1; unlock(&sched); // Slow path - all the cpus are taken. |