File tree Expand file tree Collapse file tree 4 files changed +7
-3
lines changed Expand file tree Collapse file tree 4 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -405,7 +405,11 @@ var LibraryPThread = {
405
405
#if ENVIRONMENT_MAY_BE_WEB || ENVIRONMENT_MAY_BE_WORKER
406
406
// This is the way that we signal to the Web Worker that it is hosting
407
407
// a pthread.
408
+ #if ASSERTIONS
409
+ 'name' : 'em-pthread-' + PThread . nextWorkerID ,
410
+ #else
408
411
'name' : 'em-pthread' ,
412
+ #endif
409
413
#endif
410
414
} ;
411
415
#if EXPORT_ES6 && USE_ES6_IMPORT_META
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIR
112
112
113
113
// The way we signal to a worker that it is hosting a pthread is to construct
114
114
// it with a specific name.
115
- var ENVIRONMENT_IS_PTHREAD = ENVIRONMENT_IS_WORKER && self . name == 'em-pthread' ;
115
+ var ENVIRONMENT_IS_PTHREAD = ENVIRONMENT_IS_WORKER && self . name ?. startsWith ( 'em-pthread' ) ;
116
116
117
117
#if MODULARIZE && ASSERTIONS
118
118
if ( ENVIRONMENT_IS_PTHREAD ) {
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ function ready() {
138
138
// MINIMAL_RUNTIME does not support --proxy-to-worker option, so Worker and Pthread environments
139
139
// coincide.
140
140
var ENVIRONMENT_IS_WORKER = typeof importScripts == 'function' ;
141
- var ENVIRONMENT_IS_PTHREAD = ENVIRONMENT_IS_WORKER && self . name == 'em-pthread' ;
141
+ var ENVIRONMENT_IS_PTHREAD = ENVIRONMENT_IS_WORKER && self . name ?. startsWith ( 'em-pthread' ) ;
142
142
143
143
#if ! MODULARIZE
144
144
// In MODULARIZE mode _scriptName needs to be captured already at the very top of the page immediately when the page is parsed, so it is generated there
Original file line number Diff line number Diff line change @@ -2458,7 +2458,7 @@ def modularize():
2458
2458
# when running in MODULARIZE mode we need use this to know if we should
2459
2459
# run the module constructor on startup (true only for pthreads).
2460
2460
if settings .ENVIRONMENT_MAY_BE_WEB or settings .ENVIRONMENT_MAY_BE_WORKER :
2461
- src += "var isPthread = globalThis.self?.name === 'em-pthread';\n "
2461
+ src += "var isPthread = globalThis.self?.name?.startsWith( 'em-pthread') ;\n "
2462
2462
# In order to support both web and node we also need to detect node here.
2463
2463
if settings .ENVIRONMENT_MAY_BE_NODE :
2464
2464
src += "var isNode = typeof globalThis.process?.versions?.node == 'string';\n "
You can’t perform that action at this time.
0 commit comments