emscripten-core / emscripten-core/emscripten
Allow low level pthread APIs to be called from Wasm Workers.
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
As of today in pure Wasm Worker build its simply not possible to call pthread functions.
In hybrid Wasm Workers + pthreads builds the APIs are available but we get undefined behaviour if pthread APIs are called from a Wasm Worker (since pthread_self() returns NULL).
Even in the pure Wasm Worker builds its problematic that we cannot use low level pthread APIs. For example we recently have to patch libc++ to avoid the pthread_mutex API. See #26345
We recently had some discussion of allowing pthread APIs in Wasm Workers, provided it can be done at zero cost for programs that don't use these APIs: https://github.com/emscripten-core/emscripten/pull/26568#issuecomment-4158200448
Contributor guide
Assessment
This issue has not been assessed yet.