-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Append em-pthread id to the web worker name. #22644
Conversation
Currently all web workers created for threads are called "em-pthread". So when using browser debug tools, you have to try out one web worker after another until you find the one you'd like to debug. |
5ef6a5a
to
5748048
Compare
src/library_pthread.js
Outdated
@@ -405,7 +405,7 @@ var LibraryPThread = { | |||
#if ENVIRONMENT_MAY_BE_WEB || ENVIRONMENT_MAY_BE_WORKER | |||
// This is the way that we signal to the Web Worker that it is hosting | |||
// a pthread. | |||
'name': 'em-pthread', | |||
'name': 'em-pthread_' + PThread.nextWorkerID, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use a hyphen here?
It looks like closure does't like this:
|
Ah yes, |
Thanks for the finding! I'm not well familiar with the Emscripten code base. I've pushed a commit where I add a new variable |
I would rather you use the existing nextWorkerID, but only add the |
Simplifies picking a web worker when using browser debug tools.
I'd prefer to always have worker thread IDs. Without IDs debugging is just pure pain. But I've just pushed a commit which puts Note: |
Exactly. Also any build with Also, just to be clear, you are aware there this is not actually a pthread ID but a worker ID, and a single worker and be re-used to hold different pthreads since they get reused once a pthread exits. |
Good to know.
I know the difference, even though I sometimes miss to distinguish between C / C++ thread and web worker. I didn't know that emscripten reuses a worker when it's assigned thread dies. But debugging short lived threads is anyway always a little harder. And for long living threads the merged solution is very helpful I think.
Thanks! |
Simplifies picking a web worker when using browser debug tools.