aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime
diff options
context:
space:
mode:
authorJan Ziak <0xe2.0x9a.0x9b@gmail.com>2013-03-20 20:36:33 +0100
committerJan Ziak <0xe2.0x9a.0x9b@gmail.com>2013-03-20 20:36:33 +0100
commit2001f0c28ef4f2b7b907d060901a6fad2f1e9eb0 (patch)
treedaae0b21c75ce0a1f232a40616d6629f8416c358 /src/pkg/runtime
parentbd21f7f1b59325d128bec1d26074aba75dc18b04 (diff)
downloadgo-2001f0c28ef4f2b7b907d060901a6fad2f1e9eb0.tar.xz
runtime: prevent garbage collection during hashmap insertion (fix 2)
Fixes #5074 in multi-threaded scenarios. R=golang-dev, daniel.morsing, dave, dvyukov, bradfitz, rsc CC=golang-dev, remyoudompheng https://golang.org/cl/7916043
Diffstat (limited to 'src/pkg/runtime')
-rw-r--r--src/pkg/runtime/malloc.goc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc
index aae3d233fc..fa28e2b738 100644
--- a/src/pkg/runtime/malloc.goc
+++ b/src/pkg/runtime/malloc.goc
@@ -35,7 +35,7 @@ runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed)
MSpan *s;
void *v;
- if(runtime·gcwaiting && g != m->g0 && m->locks == 0)
+ if(runtime·gcwaiting && g != m->g0 && m->locks == 0 && dogc)
runtime·gosched();
if(m->mallocing)
runtime·throw("malloc/free - deadlock");