emscripten-core / emscripten-core/emscripten

Name pthread workers for easier debugging

Open
#12,216 12 comments 3 reactions 0 assignees View on GitHub
good first bug help wanted
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.
![Screen Shot 2020-09-15 at 10 55 05 am](https://user-images.githubusercontent.com/7401419/93189155-217d8d80-f742-11ea-856d-276f005bd1e1.png)
![Screen Shot 2020-09-15 at 10 55 12 am](https://user-images.githubusercontent.com/7401419/93189159-22aeba80-f742-11ea-8ea8-c55f1b0bcded.png)

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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.