aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/runtime_wasm_js_scheduler.go
blob: fc599a2a824814174efb6d17c11c064ee1d43737 (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

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
}