]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: in exitsyscall, avoid confusing garbage collector
authorRuss Cox <rsc@golang.org>
Tue, 15 Dec 2009 03:06:20 +0000 (19:06 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 15 Dec 2009 03:06:20 +0000 (19:06 -0800)
R=r
CC=golang-dev
https://golang.org/cl/178046

src/pkg/runtime/proc.c

index f04cb6692802ac41ce04a8a2e19dcc190ac2f6f5..e81089bfae03c3892f15955c622c0a091dec575f 100644 (file)
@@ -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.