aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_wasm_js_scheduler.go
blob: 0edde29eb5971d5e5c1f75b2f74572f1e457e918 (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 && !wasip1 && !wasip2 && !wasm_unknown

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
}