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
This commit is contained in:
Jan Ziak 2013-03-20 20:36:33 +01:00
parent bd21f7f1b5
commit 2001f0c28e
1 changed files with 1 additions and 1 deletions

View File

@ -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");