Pass context into NewRuntime (#748)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
This commit is contained in:
@@ -25,7 +25,7 @@ func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create a new WebAssembly Runtime.
|
||||
r := wazero.NewRuntime()
|
||||
r := wazero.NewRuntime(ctx)
|
||||
defer r.Close(ctx) // This closes everything this Runtime created.
|
||||
|
||||
// Instantiate a Go-defined module named "env" that exports a function to
|
||||
|
||||
@@ -26,7 +26,7 @@ func main() {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create a new WebAssembly Runtime.
|
||||
r := wazero.NewRuntimeWithConfig(wazero.NewRuntimeConfig().
|
||||
r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfig().
|
||||
// Enable WebAssembly 2.0 support, which is required for TinyGo 0.24+.
|
||||
WithWasmCore2())
|
||||
defer r.Close(ctx) // This closes everything this Runtime created.
|
||||
|
||||
@@ -31,7 +31,7 @@ func run() error {
|
||||
ctx := context.Background()
|
||||
|
||||
// Create a new WebAssembly Runtime.
|
||||
r := wazero.NewRuntimeWithConfig(wazero.NewRuntimeConfig().
|
||||
r := wazero.NewRuntimeWithConfig(ctx, wazero.NewRuntimeConfig().
|
||||
// Enable WebAssembly 2.0 support.
|
||||
WithWasmCore2(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user