internal/task: swap stack chain when switching goroutines

This change swaps the stack chain when switching goroutines, ensuring that the chain is maintained consistently.
This is only really currently necessary with asyncify on wasm.
This commit is contained in:
Nia Waldvogel
2021-12-14 16:48:11 -05:00
committed by Ayke
parent d5c0083085
commit e4de7b4957
10 changed files with 51 additions and 4 deletions
+3
View File
@@ -1,3 +1,4 @@
//go:build scheduler.tasks
// +build scheduler.tasks
package task
@@ -54,7 +55,9 @@ func pause() {
// This may only be called from the scheduler.
func (t *Task) Resume() {
currentTask = t
t.gcData.swap()
t.state.resume()
t.gcData.swap()
currentTask = nil
}