Commit 19c18358 authored by Russ Cox's avatar Russ Cox

runtime: in exitsyscall, avoid confusing garbage collector

R=r
CC=golang-dev
https://golang.org/cl/178046
parent 31de4d4c
...@@ -566,14 +566,19 @@ runtime·exitsyscall(void) ...@@ -566,14 +566,19 @@ runtime·exitsyscall(void)
unlock(&sched); unlock(&sched);
return; return;
} }
g->status = Grunning;
sched.msyscall--; sched.msyscall--;
sched.mcpu++; sched.mcpu++;
// Fast path - if there's room for this m, we're done. // Fast path - if there's room for this m, we're done.
if(sched.mcpu <= sched.mcpumax) { if(sched.mcpu <= sched.mcpumax) {
g->status = Grunning;
unlock(&sched); unlock(&sched);
return; 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); unlock(&sched);
// Slow path - all the cpus are taken. // Slow path - all the cpus are taken.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment