aboutsummaryrefslogtreecommitdiff
path: root/src/pkg
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-03 12:48:32 -0400
committerRuss Cox <rsc@golang.org>2014-09-03 12:48:32 -0400
commit176c44699b5be7861070c01856494b6b94ff918a (patch)
treeca0ab85e93787a5e2a9e2dee2e55026301e0f026 /src/pkg
parent467a6d28be15cfef05870262345201b133dc1a89 (diff)
downloadgo-176c44699b5be7861070c01856494b6b94ff918a.tar.xz
runtime: remove guard against uninitialized forcegc.g
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
Diffstat (limited to 'src/pkg')
-rw-r--r--src/pkg/runtime/proc.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index b159215d1b..71ea89705b 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -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);
}