From: Russ Cox Date: Tue, 15 Dec 2009 03:06:20 +0000 (-0800) Subject: runtime: in exitsyscall, avoid confusing garbage collector X-Git-Tag: weekly.2009-12-22~62 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=19c18358ca108363d3facd5ca5b39f0048b4ddb5;p=gostls13.git runtime: in exitsyscall, avoid confusing garbage collector R=r CC=golang-dev https://golang.org/cl/178046 --- diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index f04cb66928..e81089bfae 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.