Doesn't kotlinx.coroutines support
true multi-threading on WASM target ? I know it's experimental but it's an interesting WIP
It seems wasm introduced atomic operations to lay the groundwork for true multhreading but it's apparently not rolled out or stable on all browsers ? or is it already there with all android-like dispatchers and true multithreading support instead of some scheduling magic on a single thread at the end of the day.
While Dispatchers.Default and Dispatchers.IO are supported in Kotlin's coroutine model, their behavior on WASM is constrained by the current state of WebAssembly's threading support. These dispatchers typically rely on background threads or thread pools to offload tasks, but in WASM, where true multithreading is still experimental and not universally supported, these dispatchers will operate in a similar way to Dispatchers.Main, running tasks on the same main thread.
It almost sounds like what we're seeing here is a sophisticated scheduling optimization found precisely in Javascript target, which is constrained obviously by javascript's 1 main thread restriction. Right ?
edit: found on rust forums that WASM Threads are released for chrome already with atomic ops and
SharedArrayBuffer
! but not for other browsers 🤔