Commit 88e0c051 authored by Russ Cox's avatar Russ Cox

runtime: fix comment (lost in shuffle)

TBR=dvyukov
CC=golang-dev
https://golang.org/cl/4710041
parent c9152a85
...@@ -210,8 +210,11 @@ runtime·idlegoroutine(void) ...@@ -210,8 +210,11 @@ runtime·idlegoroutine(void)
static void static void
mcommoninit(M *m) mcommoninit(M *m)
{ {
// Add to runtime·allm so garbage collector doesn't free m
// when it is just in a register or thread-local storage.
m->alllink = runtime·allm; m->alllink = runtime·allm;
runtime·allm = m; runtime·allm = m;
m->id = runtime·sched.mcount++; m->id = runtime·sched.mcount++;
m->fastrand = 0x49f6428aUL + m->id; m->fastrand = 0x49f6428aUL + m->id;
m->stackalloc = runtime·malloc(sizeof(*m->stackalloc)); m->stackalloc = runtime·malloc(sizeof(*m->stackalloc));
...@@ -502,8 +505,6 @@ matchmg(void) ...@@ -502,8 +505,6 @@ matchmg(void)
// Find the m that will run g. // Find the m that will run g.
if((m = mget(g)) == nil){ if((m = mget(g)) == nil){
m = runtime·malloc(sizeof(M)); m = runtime·malloc(sizeof(M));
// Add to runtime·allm so garbage collector doesn't free m
// when it is just in a register or thread-local storage.
mcommoninit(m); mcommoninit(m);
if(runtime·iscgo) { if(runtime·iscgo) {
......
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