bytecodealliance / bytecodealliance/wasmtime-dotnet

Question: Thread-Safety

Open
#90 13 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
519
Forks
67
Avg merge
1h 7m
Merged PRs (30d)
1

Description

I have asked that in the past most likely via an at-mention in https://github.com/christophwille/dotnet-opa-wasm/ - but today it came back up for multi-threaded usage of the Wasmtime API. I have cooked up a sample and I am pretty sure I remember our past discussion wrongly... the overall goal is to not incur the compilation hit.

https://github.com/christophwille/dotnet-opa-wasm/blob/master/spikes/HigherLevelApisSpike/IPolicyFactory.cs#L129

I load a wasm file into a byte array, create an engine and use the engine for module load - and for the sake of discussion, throw away that engine. The question now is: is Module safe to use in parallel later for

// _store is created on a new Engine, _linker same
var instance = _linker.Instantiate(_store, module);

Ie can one cached Module be used to create unlimited instances *in parallel*.

Thanks.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.