]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: remove guard against uninitialized forcegc.g
authorRuss Cox <rsc@golang.org>
Wed, 3 Sep 2014 16:48:32 +0000 (12:48 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 3 Sep 2014 16:48:32 +0000 (12:48 -0400)
The race was in the old C code.
The new Go code does not have the race
and does not need the check.

LGTM=bradfitz, dvyukov
R=golang-codereviews, bradfitz, dvyukov
CC=golang-codereviews, rlh
https://golang.org/cl/140180043

src/pkg/runtime/proc.c

index b159215d1b7c35a16702af68d575e3876b413f52..71ea89705bdc67a13eda3114de616588bd194593 100644 (file)
@@ -2955,12 +2955,9 @@ sysmon(void)
                lastgc = runtime·atomicload64(&mstats.last_gc);
                if(lastgc != 0 && unixnow - lastgc > forcegcperiod && runtime·atomicload(&runtime·forcegc.idle)) {
                        runtime·lock(&runtime·forcegc.lock);
-                       if(runtime·forcegc.g != nil) {
-                               // Goroutine may be started but has not initialized g yet.
-                               runtime·forcegc.idle = 0;
-                               runtime·forcegc.g->schedlink = nil;
-                               injectglist(runtime·forcegc.g);
-                       }
+                       runtime·forcegc.idle = 0;
+                       runtime·forcegc.g->schedlink = nil;
+                       injectglist(runtime·forcegc.g);
                        runtime·unlock(&runtime·forcegc.lock);
                }