emscripten-core / emscripten-core/emscripten
Name pthread workers for easier debugging
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
This is a feature suggestion.
Workers [accept an optional name](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker) which can be used for debugging, e.g. in DevTools we show the name in the Sources panel.


The name is also available to the worker via `globalThis.name`.
My suggestion is that in src/library_pthread.js, in `allocateUnusedWorker` when we call `new Worker()`, we give a useful name like `pthread #1` etc.
Right now threads just show up with the file name (which also means all the threads have the same name).
Contributor guide
Assessment
This issue has not been assessed yet.