For wasm32-wasip3 the public ABI of the pthread_* primitives (e.g. mutex/condvar/rwlock/etc) currently change with -DENABLE_COOP_THREADS=ON. This'll make the bindings story for languages like Rust more difficult in the wasip3 world and is, I believe, ideally something we should avoid. In talking with @TartanLlama about this what I'm thinking we might be able to do here is:
- Unconditionally, for all wasi targets, compile the wasi-threads primitives for mutexes/condvars/etc
- Have a #ifdef'd implementation for a futex-style API
- On wasip1/2/3 w/o threads this just returns an error/panics/traps/etc on blocking
- On wasi-threads it does
memory.atomic.*
- On coop threads it does
__waitlist_node or what's there today
- This additionally paves the way to exporting a futex-style API from wasi-libc itself for other languages like Rust to use
For
wasm32-wasip3the public ABI of thepthread_*primitives (e.g. mutex/condvar/rwlock/etc) currently change with-DENABLE_COOP_THREADS=ON. This'll make the bindings story for languages like Rust more difficult in the wasip3 world and is, I believe, ideally something we should avoid. In talking with @TartanLlama about this what I'm thinking we might be able to do here is:memory.atomic.*__waitlist_nodeor what's there today