mirror of
https://github.com/golang/go
synced 2024-11-25 05:57:57 -07:00
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
This commit is contained in:
parent
6d7583d5fd
commit
e1b47159ab
@ -551,15 +551,15 @@ void
|
|||||||
·entersyscall(void)
|
·entersyscall(void)
|
||||||
{
|
{
|
||||||
lock(&sched);
|
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) {
|
if(sched.predawn) {
|
||||||
unlock(&sched);
|
unlock(&sched);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g->status = Gsyscall;
|
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.mcpu--;
|
||||||
sched.msyscall++;
|
sched.msyscall++;
|
||||||
if(sched.gwait != 0)
|
if(sched.gwait != 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user