aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_wasm_js_scheduler.go
blob: 8f8823fef28d8dcedbea7d9500914af89ce94274 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
//go:build wasm && !wasi && !scheduler.none

package runtime

//export resume
func resume() {
	go func() {
		handleEvent()
	}()

	if wasmNested {
		minSched()
		return
	}

	wasmNested = true
	scheduler()
	wasmNested = false
}

//export go_scheduler
func go_scheduler() {
	if wasmNested {
		minSched()
		return
	}

	wasmNested = true
	scheduler()
	wasmNested = false
}