Commit 71108810 authored by Russ Cox's avatar Russ Cox

runtime: fix bug in preemption checks; was causing "lock count" panics

R=r
CC=golang-dev
https://golang.org/cl/186078
parent 9d4d7d8f
......@@ -27,7 +27,7 @@ mallocgc(uintptr size, uint32 refflag, int32 dogc)
void *v;
uint32 *ref;
if(gcwaiting && g != m->g0)
if(gcwaiting && g != m->g0 && m->locks == 0)
gosched();
if(m->mallocing)
throw("malloc/free - deadlock");
......
......@@ -523,6 +523,8 @@ scheduler(void)
void
gosched(void)
{
if(m->locks != 0)
throw("gosched holding locks");
if(g == m->g0)
throw("gosched of g0");
if(gosave(&g->sched) == 0)
......
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