mirror of
https://github.com/apple/swift.git
synced 2026-06-20 15:42:51 +02:00
c8b8cc9cd8
When Swift runs on wasm32-unknown-wasip1-threads in a web browser, WebAssembly waiting instructions cannot be used on the main thread. However, Synchronization mutex locking currently assumes it may block in that situation, which makes contended locking fail in browser hosts when it reaches `llvm.wasm.memory.atomic.wait32`. (you will see `Atomics.wait cannot be called in this context`) wasi-libc has an opt-in mode that makes futex wait on a thread to use busywait instead of `atomic.wait32`. This change adopts the same model by referencing the same opt-in flag. See: WebAssembly/wasi-libc#562.