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