diff options
author | Ian Lance Taylor <iant@golang.org> | 2010-05-06 22:07:03 -0700 |
---|---|---|
committer | Ian Lance Taylor <iant@golang.org> | 2010-05-06 22:07:03 -0700 |
commit | 6bb67a911ed4c7c8dd326b783598b14a8e855677 (patch) | |
tree | 3f668209fb83aa11b0e2be85e12c7543bd3cdd82 /src | |
parent | d6b84ed3d53cf458a111d97c981bf323fb041e54 (diff) | |
download | golang-6bb67a911ed4c7c8dd326b783598b14a8e855677.tar.gz |
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
http://codereview.appspot.com/1123043
Diffstat (limited to 'src')
-rw-r--r-- | src/pkg/runtime/proc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c index 0fef16aa6..a587a7fd4 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) |