diff options
| author | Keith Randall <khr@golang.org> | 2013-08-19 12:20:50 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2013-08-19 12:20:50 -0700 |
| commit | 6401e0f83f29b0f3b03b9d07ebcab56e5ddb461b (patch) | |
| tree | b0f1f31288ff73d03ab415e9c78afadac5023318 /src | |
| parent | 88ee849a8a1c4e3b63874fcbb8a5bb6eebeeb98b (diff) | |
| download | go-6401e0f83f29b0f3b03b9d07ebcab56e5ddb461b.tar.xz | |
runtime: don't run finalizers if we're still on the g0 stack.
R=golang-dev, rsc, dvyukov, khr
CC=golang-dev
https://golang.org/cl/11386044
Diffstat (limited to 'src')
| -rw-r--r-- | src/pkg/runtime/mgc0.c | 7 | ||||
| -rw-r--r-- | src/pkg/runtime/stack.c | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index f7162da1f0..0084ca108b 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -2098,7 +2098,7 @@ runtime·gc(int32 force) runtime·starttheworld(); m->locks--; - // now that gc is done and we're back on g stack, kick off finalizer thread if needed + // now that gc is done, kick off finalizer thread if needed if(finq != nil) { runtime·lock(&finlock); // kick off or wake up goroutine to run queued finalizers @@ -2109,11 +2109,12 @@ runtime·gc(int32 force) runtime·ready(fing); } runtime·unlock(&finlock); - // give the queued finalizers, if any, a chance to run - runtime·gosched(); } if(g->preempt) // restore the preemption request in case we've cleared it in newstack g->stackguard0 = StackPreempt; + // give the queued finalizers, if any, a chance to run + if(g != m->g0) + runtime·gosched(); } static void diff --git a/src/pkg/runtime/stack.c b/src/pkg/runtime/stack.c index dd823705da..32d6fd4650 100644 --- a/src/pkg/runtime/stack.c +++ b/src/pkg/runtime/stack.c @@ -105,7 +105,7 @@ runtime·stackalloc(uint32 n) m->stackinuse++; return v; } - return runtime·mallocgc(n, 0, FlagNoProfiling|FlagNoGC|FlagNoZero|FlagNoInvokeGC); + return runtime·mallocgc(n, 0, FlagNoProfiling|FlagNoGC|FlagNoZero); } void |
