Extend C API with interfaces needed to use threads#7940
Extend C API with interfaces needed to use threads#7940alexcrichton merged 1 commit intobytecodealliance:mainfrom
Conversation
|
From the context here I'm not sure why the wasmtime_wasictx methods are required to use threads. I'm planning a renovation which will swap out the c api's wasi implementation from |
|
I think adding bits and functions to manage shared memories in the C API would be great to have, but I would agree with @pchickey that the WASI bits may want to be left out for now. I would echo his same sentiments in terms of it's not clear what to do with the implementation of WASI and threads in the wasmtime repo into the future and I think it would be best to not add new dependencies on something we're hoping to remove (aka |
|
wasictx constructor is needed to attach the same WASI context to multiple instances (threads). If preview2 does not support threads that's somewhat of a problem for my use-case :( |
Subscribe to Label Actioncc @peterhuene DetailsThis issue or pull request has been labeled: "wasmtime:c-api"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
|
@Milek7, you may be interested in WebAssembly/component-model#291. Let's talk more tomorrow on Zulip; maybe you want to help out with implementing some of those bits? |
|
That makes sense that wasi contexts can't be shared today, but this API being added is exposing a contract where a wasi context can be attached to multiple stores which we may not wish to guarantee. For example thisi enables having one long-lived wasi context which is shared over its lifetime by many instances. While a perhaps interesting use case that's not necessarily something I think we want to commit to just yet. |
|
Dropped wasictx functions. |
|
Ok, thanks! Can you detail more how come this couldn't be folded into |
|
I was having some trouble with it, but looking at it now I might have confused wasmtime_extern_t with wasm_extern_t, ouch. I will take another look next week. |
|
Ah ok makes sense! In that case yeah I'd recommend trying to get this integrated with the |
ad4379d to
d951a8e
Compare
|
Done |
I'm not sure how to handle SharedMemory here. Possibly it could use Extern interfaces, but I had some trouble with it. Extern seem to assume that it's associated with Store, but shared memories aren't. Instead I added dedicated
wasmtime_linker_define_sharedmemory. Is this acceptable or I need to fight with Extern more to get it to work?