You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Considering Lack of atomic.wait on the main thread it looks like the only way for me to use threads with wasm-bindgen is to manually implement allocator that uses mutexes for global lock, and spinlocks if in main thread?
The text was updated successfully, but these errors were encountered:
After looking at sys implementation for wasm i found that allocator is actually always spinlocked, and should be safe to use. Was a bit misled by the comments inside dlmalloc-rs and Multithreading Rust and Wasm blogpost from year earlier. Closing.
Yes looks like you answered your own question! Multi-threaded memory allocation works with a spinlock today. It's pretty bad. There's a nice long comment in the source though explaining why we chose the bad route for now.
Am i correct in that memory allocation in raytrace demo (and more generally in multithreaded wasm) compiled with wasm-bindgen is currently broken?
dlmalloc-rs wasm implementation assumes that it is run single-threaded, and it's the default memory allocator in wasm at this point.
Am i missing something? @alexcrichton
Considering Lack of atomic.wait on the main thread it looks like the only way for me to use threads with wasm-bindgen is to manually implement allocator that uses mutexes for global lock, and spinlocks if in main thread?
The text was updated successfully, but these errors were encountered: