Debian Codegraph @

imports/wasi_snapshot_preview1/sched.go

raw symbols SCIP
1 package wasi_snapshot_preview1
2
3 import (
4 "context"
5
6 "github.com/tetratelabs/wazero/api"
7 "github.com/tetratelabs/wazero/experimental/sys"
8 "github.com/tetratelabs/wazero/internal/wasip1"
9 "github.com/tetratelabs/wazero/internal/wasm"
10 )
11
12 // schedYield is the WASI function named SchedYieldName which temporarily
13 // yields execution of the calling thread.
14 //
15 // See https://github.com/WebAssembly/WASI/blob/snapshot-01/phases/snapshot/docs.md#-sched_yield---errno
16 var schedYield = newHostFunc(wasip1.SchedYieldName, schedYieldFn, nil)
17
18 func schedYieldFn(_ context.Context, mod api.Module, _ []uint64) sys.Errno {
19 sysCtx := mod.(*wasm.ModuleInstance).Sys
20 sysCtx.Osyield()
21 return 0
22 }