runtime: fix init scheduling bug.
if there is a goroutine waiting to run
and the init goroutine enters a system call,
entersyscall was trying to kick off a new
scheduler for the other goroutine, causing
a panic (new goroutines can't run until main.main).
R=r
DELTA=32 (32 added, 0 deleted, 0 changed)
OCL=31982
CL=31982
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index cffdf1b..3c8ef54 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -478,6 +478,10 @@
USED(callerpc, trap);
lock(&sched);
+ if(sched.predawn) {
+ unlock(&sched);
+ return;
+ }
g->status = Gsyscall;
// Leave SP around for gc and traceback.
// Do before notewakeup so that gc
@@ -502,6 +506,10 @@
sys·exitsyscall(void)
{
lock(&sched);
+ if(sched.predawn) {
+ unlock(&sched);
+ return;
+ }
g->status = Grunning;
sched.msyscall--;
sched.mcpu++;