emscripten-core / emscripten-core/emscripten
Distinction of main browser and main runtime thread in threading.h
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Hi there, I think there a few irregularities in threading.h:
* [emscripten_main_browser_thread_id](https://github.com/emscripten-core/emscripten/blob/dbfd3ac9fd990f74102503f7cc9a5a3412b216c9/system/include/emscripten/threading.h#L364) seems to be a misnomer, since its cached value is actually [set to the main _runtime_ thread id](https://github.com/emscripten-core/emscripten/blob/cc2fc364bce62e2c40749d05a0f5cec0191a61a9/src/library_pthread.js#L76), which is not necessarily the main browser thread.
* Additionally it would probably be helpful if the names of [emscripten_main_thread_process_queued_calls](https://github.com/emscripten-core/emscripten/blob/dbfd3ac9fd990f74102503f7cc9a5a3412b216c9/system/include/emscripten/threading.h#L360) and all variants of [emscripten_sync_run_in_main_thread](https://github.com/emscripten-core/emscripten/blob/dbfd3ac9fd990f74102503f7cc9a5a3412b216c9/system/include/emscripten/threading.h#L157) would explicitly state that they are referring to the main _runtime_ thread.
* Lastly I could not find a detailed description of the distinction between main browser and runtime thread other than https://github.com/emscripten-core/emscripten/pull/12102#issue-478629867.
Sorry to open an issue instead of a pull request, but I'm not confident I'll find the time to tackle this myself and I certainly can't estimate the impact of tampering with this API.
Contributor guide
Assessment
This issue has not been assessed yet.