From: Ian Lance Taylor Date: Fri, 7 May 2010 05:07:03 +0000 (-0700) Subject: Save the scheduling state even predawn. X-Git-Tag: weekly.2010-05-27~103 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e1b47159ab8218973e49eb0103f4fda57e6db864;p=gostls13.git Save the scheduling state even predawn. This permits cgo callbacks to work when run in init code. Otherwise cgocallback switches to the wrong stack address. R=rsc CC=golang-dev https://golang.org/cl/1123043 --- diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 0fef16aa6e..a587a7fd43 100644 --- a/src/pkg/runtime/proc.c +++ b/src/pkg/runtime/proc.c @@ -551,15 +551,15 @@ void ·entersyscall(void) { lock(&sched); + // Leave SP around for gc and traceback. + // Do before notewakeup so that gc + // never sees Gsyscall with wrong stack. + gosave(&g->sched); if(sched.predawn) { unlock(&sched); return; } g->status = Gsyscall; - // Leave SP around for gc and traceback. - // Do before notewakeup so that gc - // never sees Gsyscall with wrong stack. - gosave(&g->sched); sched.mcpu--; sched.msyscall++; if(sched.gwait != 0)