Commit 2001f0c2 authored by Jan Ziak's avatar Jan Ziak

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
parent bd21f7f1
...@@ -35,7 +35,7 @@ runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed) ...@@ -35,7 +35,7 @@ runtime·mallocgc(uintptr size, uint32 flag, int32 dogc, int32 zeroed)
MSpan *s; MSpan *s;
void *v; void *v;
if(runtime·gcwaiting && g != m->g0 && m->locks == 0) if(runtime·gcwaiting && g != m->g0 && m->locks == 0 && dogc)
runtime·gosched(); runtime·gosched();
if(m->mallocing) if(m->mallocing)
runtime·throw("malloc/free - deadlock"); runtime·throw("malloc/free - deadlock");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment