Adds gojs.MustInstantiate to avoid conflicts (#940)

This separate host from guest instantiation in ways similar to other
imports such as emscripten. Doing so allows parallel use of gojs.Run,
provided the ModuleConfig has been assigned a unique name (e.g. via an
atomic number).

Fixes #939

Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
Crypt Keeper
2022-12-19 18:50:55 +09:00
committed by GitHub
parent b1cb9140dd
commit 1f7f20ee2f
4 changed files with 94 additions and 46 deletions

View File

@@ -27,6 +27,8 @@ func compileAndRun(ctx context.Context, arg string, config wazero.ModuleConfig)
r := wazero.NewRuntimeWithConfig(testCtx, wazero.NewRuntimeConfig())
defer r.Close(ctx)
gojs.MustInstantiate(ctx, r)
compiled, compileErr := r.CompileModule(ctx, testBin)
if compileErr != nil {
err = compileErr