runtime: check for preemption due to garbage collection

in various already expensive routines.

helps keep cpu utilization up when GOMAXPROCS > 1,
but not a full solution.

http://groups.google.com/group/golang-nuts/t/7a9535c4136d3e2

R=r
CC=golang-dev
https://golang.org/cl/184043
This commit is contained in:
Russ Cox 2010-01-09 09:47:45 -08:00
parent 752b1702d0
commit 5328df6534
6 changed files with 29 additions and 2 deletions

View file

@ -27,10 +27,11 @@ mallocgc(uintptr size, uint32 refflag, int32 dogc)
void *v;
uint32 *ref;
if(gcwaiting && g != m->g0)
gosched();
if(m->mallocing)
throw("malloc/free - deadlock");
m->mallocing = 1;
if(size == 0)
size = 1;