Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to wasi-libc to use busy-wait instead of memory.atomic.wait32 #5598

Open
1 of 3 tasks
kateinoigakukun opened this issue Dec 2, 2024 · 0 comments
Open
1 of 3 tasks

Comments

@kateinoigakukun
Copy link
Member

kateinoigakukun commented Dec 2, 2024

wasi-libc uses memory.atomic.wait32 in __wasilibc_futex_wait, which is called by several functions in wasi-libc including malloc, fwrite, and etc.

However, the use of memory.atomic.wait32 on the Web browser main thread (and also Audio Worklet) is prohibited. We need to do something Emscripten is doing in wasi-libc side.
https://github.com/emscripten-core/emscripten/blob/058a9fff/system/lib/pthread/emscripten_futex_wait.c#L111-L150

@kateinoigakukun kateinoigakukun converted this from a draft issue Dec 2, 2024
@kateinoigakukun kateinoigakukun moved this from Backlog to Ready in Yuta's project Dec 16, 2024
@kateinoigakukun kateinoigakukun moved this from Ready to In progress in Yuta's project Dec 17, 2024
@kateinoigakukun kateinoigakukun changed the title Add option to wasi-libc to use spin-lock instead of memory.atomic.wait32 Add option to wasi-libc to use busy-wait instead of memory.atomic.wait32 Jan 19, 2025
@kateinoigakukun kateinoigakukun moved this from In progress to In review in Yuta's project Jan 20, 2025
abrown pushed a commit to WebAssembly/wasi-libc that referenced this issue Jan 20, 2025
This change enables the pthread-related tests in the libc-test suite.
The tests are enabled only for the `wasm32-wasip1-threads` target, which
is the only target that supports threads at the moment.

The following pthread tests are still disabled:
- pthread_cancel-points.c
- pthread_cancel.c
- pthread_robust.c

This is a preparative change for
swiftwasm/swift#5598
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In review
Development

No branches or pull requests

1 participant