Skip to content

Commit aa135a0

Browse files
committed
Remove ENVIRONMENT_IS_PTHREAD variable. The existence of this variable predates to the time when pthreads still supported --proxy-to-worker mode (and --proxy-to-pthread did not exist). After --proxy-to-pthread has proven itself as a more usable method and USE_PTHREADS + --proxy-to-worker was deprecated, there is no longer need to distinguish between "am I a worker" or "am I a pthread", as all workers are pthreads, and the scenario "worker that is the proxied main thread so not a pthread" no longer happens.
1 parent e16193c commit aa135a0

23 files changed

+77
-101
lines changed

emscripten.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ def memory_and_global_initializers(pre, metadata, mem_init):
827827

828828
pthread = ''
829829
if shared.Settings.USE_PTHREADS:
830-
pthread = 'if (!ENVIRONMENT_IS_PTHREAD)'
830+
pthread = 'if (!ENVIRONMENT_IS_WORKER)'
831831

832832
global_initializers = ''
833833
if not shared.Settings.MINIMAL_RUNTIME:
@@ -977,7 +977,7 @@ def include_asm_consts(pre, forwarded_json, metadata):
977977
# indices to EM_ASM() blocks, so remap the EM_ASM() indices from 0, 1, 2,
978978
# ... over to the negative integers starting at -1.
979979
proxy_args = ['-1 - code', str(int(sync_proxy))] + args
980-
pre_asm_const += ' if (ENVIRONMENT_IS_PTHREAD) { ' + proxy_debug_print(sync_proxy) + 'return _emscripten_proxy_to_main_thread_js(' + ', '.join(proxy_args) + '); }\n'
980+
pre_asm_const += ' if (ENVIRONMENT_IS_WORKER) { ' + proxy_debug_print(sync_proxy) + 'return _emscripten_proxy_to_main_thread_js(' + ', '.join(proxy_args) + '); }\n'
981981

982982
if shared.Settings.EMTERPRETIFY_ASYNC and shared.Settings.ASSERTIONS:
983983
# we cannot have an EM_ASM on the stack when saving/loading
@@ -2211,7 +2211,7 @@ def emscript_wasm_backend(infile, outfile, memfile, compiler_engine,
22112211
pre = pre.replace('STATICTOP = STATIC_BASE + 0;', '''STATICTOP = STATIC_BASE + %d;
22122212
/* global initializers */ %s __ATINIT__.push(%s);
22132213
''' % (staticbump,
2214-
'if (!ENVIRONMENT_IS_PTHREAD)' if shared.Settings.USE_PTHREADS else '',
2214+
'if (!ENVIRONMENT_IS_WORKER)' if shared.Settings.USE_PTHREADS else '',
22152215
global_initializers))
22162216

22172217
pre = apply_memory(pre)
@@ -2402,7 +2402,7 @@ def create_asm_consts_wasm(forwarded_json, metadata):
24022402
# to regular C compiled functions. Negative integers -1, -2, -3, ... denote
24032403
# indices to EM_ASM() blocks, so remap the EM_ASM() indices from 0, 1, 2,
24042404
# ... over to the negative integers starting at -1.
2405-
preamble += ('\n if (ENVIRONMENT_IS_PTHREAD) { ' +
2405+
preamble += ('\n if (ENVIRONMENT_IS_WORKER) { ' +
24062406
proxy_debug_print(sync_proxy) +
24072407
'return _emscripten_proxy_to_main_thread_js(-1 - code, ' +
24082408
str(int(sync_proxy)) +

src/Fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ var Fetch = {
5252

5353
staticInit: function() {
5454
#if USE_FETCH_WORKER
55-
var isMainThread = (typeof ENVIRONMENT_IS_FETCH_WORKER === 'undefined' && !ENVIRONMENT_IS_PTHREAD);
55+
var isMainThread = (typeof ENVIRONMENT_IS_FETCH_WORKER === 'undefined' && !ENVIRONMENT_IS_WORKER);
5656
#else
5757
var isMainThread = (typeof ENVIRONMENT_IS_FETCH_WORKER === 'undefined');
5858
#endif

src/emrun_postjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// University of Illinois/NCSA Open Source License. Both these licenses can be
44
// found in the LICENSE file.
55

6-
if (typeof window === "object" && (typeof ENVIRONMENT_IS_PTHREAD === 'undefined' || !ENVIRONMENT_IS_PTHREAD)) {
6+
if (typeof window === "object" && (typeof ENVIRONMENT_IS_WORKER === 'undefined' || !ENVIRONMENT_IS_WORKER)) {
77
function emrun_register_handlers() {
88
// When C code exit()s, we may still have remaining stdout and stderr messages in flight. In that case, we can't close
99
// the browser until all those XHRs have finished, so the following state variables track that all communication is done,

src/fetch-worker.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ function store4(ptr, value) { HEAP32[ptr>>2] = value; }
4747

4848
var ENVIRONMENT_IS_FETCH_WORKER = true;
4949
var ENVIRONMENT_IS_WORKER = true;
50-
var ENVIRONMENT_IS_PTHREAD = true;
5150
var __pthread_is_main_runtime_thread=0;
5251
var DYNAMICTOP_PTR = 0;
5352
var nan = NaN;

src/jsifier.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ function JSify(data, functionsOnly) {
281281
assert(typeof original === 'function');
282282
contentText = modifyFunction(snippet, function(name, args, body) {
283283
return 'function ' + name + '(' + args + ') {\n' +
284-
'if (ENVIRONMENT_IS_PTHREAD) return _emscripten_proxy_to_main_thread_js(' + proxiedFunctionTable.length + ', ' + (+sync) + (args ? ', ' : '') + args + ');\n' + body + '}\n';
284+
'if (ENVIRONMENT_IS_WORKER) return _emscripten_proxy_to_main_thread_js(' + proxiedFunctionTable.length + ', ' + (+sync) + (args ? ', ' : '') + args + ');\n' + body + '}\n';
285285
});
286286
proxiedFunctionTable.push(finalName);
287287
} else {
@@ -411,7 +411,7 @@ function JSify(data, functionsOnly) {
411411
});
412412
// write out the singleton big memory initialization value
413413
if (USE_PTHREADS) {
414-
print('if (!ENVIRONMENT_IS_PTHREAD) {') // Pthreads should not initialize memory again, since it's shared with the main thread.
414+
print('if (!ENVIRONMENT_IS_WORKER) {') // Pthreads should not initialize memory again, since it's shared with the main thread.
415415
}
416416
print('/* memory initializer */ ' + makePointer(memoryInitialization, null, 'ALLOC_NONE', 'i8', 'GLOBAL_BASE' + (SIDE_MODULE ? '+H_BASE' : ''), true));
417417
if (USE_PTHREADS) {
@@ -424,7 +424,7 @@ function JSify(data, functionsOnly) {
424424
if (!SIDE_MODULE && !WASM_BACKEND) {
425425
if (USE_PTHREADS) {
426426
print('var tempDoublePtr;');
427-
print('if (!ENVIRONMENT_IS_PTHREAD) tempDoublePtr = ' + makeStaticAlloc(12) + ';');
427+
print('if (!ENVIRONMENT_IS_WORKER) tempDoublePtr = ' + makeStaticAlloc(12) + ';');
428428
} else {
429429
print('var tempDoublePtr = ' + makeStaticAlloc(8) + '');
430430
}

src/library.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4006,7 +4006,7 @@ LibraryManager.library = {
40064006
#endif
40074007
#if USE_PTHREADS
40084008
// Pthreads need their clocks synchronized to the execution of the main thread, so give them a special form of the function.
4009-
"if (ENVIRONMENT_IS_PTHREAD) {\n" +
4009+
"if (ENVIRONMENT_IS_WORKER) {\n" +
40104010
" _emscripten_get_now = function() { return performance['now']() - __performance_now_clock_drift; };\n" +
40114011
"} else " +
40124012
#endif

src/library_browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ var LibraryBrowser = {
10821082
onerror = getFuncWrapper(onerror, 'v');
10831083

10841084
#if USE_PTHREADS
1085-
if (ENVIRONMENT_IS_PTHREAD) {
1085+
if (ENVIRONMENT_IS_WORKER) {
10861086
console.error('emscripten_async_load_script("' + UTF8ToString(url) + '") failed, emscripten_async_load_script is currently not available in pthreads!');
10871087
return onerror ? onerror() : undefined;
10881088
}

src/library_fetch.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
var LibraryFetch = {
99
#if USE_PTHREADS
10-
$Fetch__postset: 'if (!ENVIRONMENT_IS_PTHREAD) Fetch.staticInit();',
10+
$Fetch__postset: 'if (!ENVIRONMENT_IS_WORKER) Fetch.staticInit();',
1111
#else
1212
$Fetch__postset: 'Fetch.staticInit();',
1313
#endif

src/library_html5.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ var LibraryJSEvents = {
23992399

24002400
#if (USE_PTHREADS && OFFSCREEN_FRAMEBUFFER)
24012401
// Create a WebGL context that is proxied to main thread if canvas was not found on worker, or if explicitly requested to do so.
2402-
if (ENVIRONMENT_IS_PTHREAD) {
2402+
if (ENVIRONMENT_IS_WORKER) {
24032403
if (contextAttributes.proxyContextToMainThread === {{{ cDefine('EMSCRIPTEN_WEBGL_CONTEXT_PROXY_ALWAYS') }}} ||
24042404
(!canvas && contextAttributes.proxyContextToMainThread === {{{ cDefine('EMSCRIPTEN_WEBGL_CONTEXT_PROXY_FALLBACK') }}})) {
24052405
// When WebGL context is being proxied via the main thread, we must render using an offscreen FBO render target to avoid WebGL's
@@ -2722,7 +2722,7 @@ var LibraryJSEvents = {
27222722
#if USE_PTHREADS && ASSERTIONS && OFFSCREENCANVAS_SUPPORT
27232723
// TODO: for Offscreencanvas case, must first search locally in the calling thread if the given context is an OffscreenCanvas context on the calling thread,
27242724
// and only if it's not, then try to proxy the call to main thread. I.e. this function cannot be unconditionally 'sync' proxied.
2725-
if (ENVIRONMENT_IS_PTHREAD) warnOnce('TODO: emscripten_is_webgl_context_lost() does not yet work properly in pthreads with OffscreenCanvas contexts');
2725+
if (ENVIRONMENT_IS_WORKER) warnOnce('TODO: emscripten_is_webgl_context_lost() does not yet work properly in pthreads with OffscreenCanvas contexts');
27262726
#endif
27272727
return !GL.contexts[target] || GL.contexts[target].GLctx.isContextLost(); // No context ~> lost context.
27282728
},

src/library_pthread.js

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// found in the LICENSE file.
55

66
var LibraryPThread = {
7-
$PThread__postset: 'if (!ENVIRONMENT_IS_PTHREAD) PThread.initMainThreadBlock(); else PThread.initWorker();',
7+
$PThread__postset: 'if (!ENVIRONMENT_IS_WORKER) PThread.initMainThreadBlock(); else PThread.initWorker();',
88
$PThread__deps: ['$PROCINFO', '_register_pthread_ptr',
99
'emscripten_main_thread_process_queued_calls',
1010
'$ERRNO_CODES', 'emscripten_futex_wake', '_kill_thread',
@@ -35,7 +35,7 @@ var LibraryPThread = {
3535
_emscripten_register_main_browser_thread_id(PThread.mainThreadBlock);
3636
},
3737
initMainThreadBlock: function() {
38-
if (ENVIRONMENT_IS_PTHREAD) return undefined;
38+
if (ENVIRONMENT_IS_WORKER) return undefined;
3939

4040
#if PTHREAD_POOL_SIZE > 0
4141
var requestedPoolSize = {{{ PTHREAD_POOL_SIZE }}};
@@ -161,7 +161,7 @@ var LibraryPThread = {
161161
}
162162

163163
// Call into the musl function that runs destructors of all thread-specific data.
164-
if (ENVIRONMENT_IS_PTHREAD && threadInfoStruct) ___pthread_tsd_run_dtors();
164+
if (ENVIRONMENT_IS_WORKER && threadInfoStruct) ___pthread_tsd_run_dtors();
165165
},
166166

167167
// Called when we are performing a pthread_exit(), either explicitly called by programmer,
@@ -188,7 +188,7 @@ var LibraryPThread = {
188188
_emscripten_futex_wake(tb + {{{ C_STRUCTS.pthread.threadStatus }}}, {{{ cDefine('INT_MAX') }}});
189189
__register_pthread_ptr(0, 0, 0); // Unregister the thread block also inside the asm.js scope.
190190
threadInfoStruct = 0;
191-
if (ENVIRONMENT_IS_PTHREAD) {
191+
if (ENVIRONMENT_IS_WORKER) {
192192
// Note: in theory we would like to return any offscreen canvases back to the main thread,
193193
// but if we ever fetched a rendering context for them that would not be valid, so we don't try.
194194
postMessage({ 'cmd': 'exit' });
@@ -483,7 +483,7 @@ var LibraryPThread = {
483483
},
484484

485485
_kill_thread: function(pthread_ptr) {
486-
if (ENVIRONMENT_IS_PTHREAD) throw 'Internal Error! _kill_thread() can only ever be called from main application thread!';
486+
if (ENVIRONMENT_IS_WORKER) throw 'Internal Error! _kill_thread() can only ever be called from main application thread!';
487487
if (!pthread_ptr) throw 'Internal Error! Null pthread_ptr in _kill_thread!';
488488
{{{ makeSetValue('pthread_ptr', C_STRUCTS.pthread.self, 0, 'i32') }}};
489489
var pthread = PThread.pthreads[pthread_ptr];
@@ -496,7 +496,7 @@ var LibraryPThread = {
496496
},
497497

498498
_cleanup_thread: function(pthread_ptr) {
499-
if (ENVIRONMENT_IS_PTHREAD) throw 'Internal Error! _cleanup_thread() can only ever be called from main application thread!';
499+
if (ENVIRONMENT_IS_WORKER) throw 'Internal Error! _cleanup_thread() can only ever be called from main application thread!';
500500
if (!pthread_ptr) throw 'Internal Error! Null pthread_ptr in _cleanup_thread!';
501501
{{{ makeSetValue('pthread_ptr', C_STRUCTS.pthread.self, 0, 'i32') }}};
502502
var pthread = PThread.pthreads[pthread_ptr];
@@ -507,14 +507,14 @@ var LibraryPThread = {
507507
},
508508

509509
_cancel_thread: function(pthread_ptr) {
510-
if (ENVIRONMENT_IS_PTHREAD) throw 'Internal Error! _cancel_thread() can only ever be called from main application thread!';
510+
if (ENVIRONMENT_IS_WORKER) throw 'Internal Error! _cancel_thread() can only ever be called from main application thread!';
511511
if (!pthread_ptr) throw 'Internal Error! Null pthread_ptr in _cancel_thread!';
512512
var pthread = PThread.pthreads[pthread_ptr];
513513
pthread.worker.postMessage({ 'cmd': 'cancel' });
514514
},
515515

516516
_spawn_thread: function(threadParams) {
517-
if (ENVIRONMENT_IS_PTHREAD) throw 'Internal Error! _spawn_thread() can only ever be called from main application thread!';
517+
if (ENVIRONMENT_IS_WORKER) throw 'Internal Error! _spawn_thread() can only ever be called from main application thread!';
518518

519519
var worker = PThread.getNewWorker();
520520

@@ -703,7 +703,7 @@ var LibraryPThread = {
703703

704704
// Synchronously proxy the thread creation to main thread if possible. If we need to transfer ownership of objects, then
705705
// proxy asynchronously via postMessage.
706-
if (ENVIRONMENT_IS_PTHREAD && (transferList.length === 0 || error)) {
706+
if (ENVIRONMENT_IS_WORKER && (transferList.length === 0 || error)) {
707707
return _emscripten_sync_run_in_main_thread_4({{{ cDefine('EM_PROXIED_PTHREAD_CREATE') }}}, pthread_ptr, attr, start_routine, arg);
708708
}
709709

@@ -792,7 +792,7 @@ var LibraryPThread = {
792792
transferList: transferList
793793
};
794794

795-
if (ENVIRONMENT_IS_PTHREAD) {
795+
if (ENVIRONMENT_IS_WORKER) {
796796
// The prepopulated pool of web workers that can host pthreads is stored in the main JS thread. Therefore if a
797797
// pthread is attempting to spawn a new thread, the thread creation must be deferred to the main JS thread.
798798
threadParams.cmd = 'spawnThread';
@@ -809,7 +809,7 @@ var LibraryPThread = {
809809
// TODO HACK! Remove this function, it is a JS side copy of the function pthread_testcancel() in library_pthread.c.
810810
// Just call pthread_testcancel() everywhere.
811811
_pthread_testcancel_js: function() {
812-
if (!ENVIRONMENT_IS_PTHREAD) return;
812+
if (!ENVIRONMENT_IS_WORKER) return;
813813
if (!threadInfoStruct) return;
814814
var cancelDisabled = Atomics.load(HEAPU32, (threadInfoStruct + {{{ C_STRUCTS.pthread.canceldisable }}} ) >> 2);
815815
if (cancelDisabled) return;
@@ -833,11 +833,11 @@ var LibraryPThread = {
833833
err('pthread_join attempted on a null thread pointer!');
834834
return ERRNO_CODES.ESRCH;
835835
}
836-
if (ENVIRONMENT_IS_PTHREAD && selfThreadId == thread) {
836+
if (ENVIRONMENT_IS_WORKER && selfThreadId == thread) {
837837
err('PThread ' + thread + ' is attempting to join to itself!');
838838
return ERRNO_CODES.EDEADLK;
839839
}
840-
else if (!ENVIRONMENT_IS_PTHREAD && PThread.mainThreadBlock == thread) {
840+
else if (!ENVIRONMENT_IS_WORKER && PThread.mainThreadBlock == thread) {
841841
err('Main thread ' + thread + ' is attempting to join to itself!');
842842
return ERRNO_CODES.EDEADLK;
843843
}
@@ -864,7 +864,7 @@ var LibraryPThread = {
864864
if (status) {{{ makeSetValue('status', 0, 'threadExitCode', 'i32') }}};
865865
Atomics.store(HEAPU32, (thread + {{{ C_STRUCTS.pthread.detached }}} ) >> 2, 1); // Mark the thread as detached.
866866

867-
if (!ENVIRONMENT_IS_PTHREAD) __cleanup_thread(thread);
867+
if (!ENVIRONMENT_IS_WORKER) __cleanup_thread(thread);
868868
else postMessage({ 'cmd': 'cleanupThread', 'thread': thread });
869869
return 0;
870870
}
@@ -876,8 +876,8 @@ var LibraryPThread = {
876876
__pthread_testcancel_js();
877877
// In main runtime thread (the thread that initialized the Emscripten C runtime and launched main()), assist pthreads in performing operations
878878
// that they need to access the Emscripten main runtime for.
879-
if (!ENVIRONMENT_IS_PTHREAD) _emscripten_main_thread_process_queued_calls();
880-
_emscripten_futex_wait(thread + {{{ C_STRUCTS.pthread.threadStatus }}}, threadStatus, ENVIRONMENT_IS_PTHREAD ? 100 : 1);
879+
if (!ENVIRONMENT_IS_WORKER) _emscripten_main_thread_process_queued_calls();
880+
_emscripten_futex_wait(thread + {{{ C_STRUCTS.pthread.threadStatus }}}, threadStatus, ENVIRONMENT_IS_WORKER ? 100 : 1);
881881
}
882882
},
883883

@@ -909,7 +909,7 @@ var LibraryPThread = {
909909
return ERRNO_CODES.ESRCH;
910910
}
911911
if (signal != 0) {
912-
if (!ENVIRONMENT_IS_PTHREAD) __kill_thread(thread);
912+
if (!ENVIRONMENT_IS_WORKER) __kill_thread(thread);
913913
else postMessage({ 'cmd': 'killThread', 'thread': thread});
914914
}
915915
return 0;
@@ -931,7 +931,7 @@ var LibraryPThread = {
931931
return ERRNO_CODES.ESRCH;
932932
}
933933
Atomics.compareExchange(HEAPU32, (thread + {{{ C_STRUCTS.pthread.threadStatus }}} ) >> 2, 0, 2); // Signal the thread that it needs to cancel itself.
934-
if (!ENVIRONMENT_IS_PTHREAD) __cancel_thread(thread);
934+
if (!ENVIRONMENT_IS_WORKER) __cancel_thread(thread);
935935
else postMessage({ 'cmd': 'cancelThread', 'thread': thread});
936936
return 0;
937937
},
@@ -955,7 +955,7 @@ var LibraryPThread = {
955955

956956
pthread_exit__deps: ['exit'],
957957
pthread_exit: function(status) {
958-
if (!ENVIRONMENT_IS_PTHREAD) _exit(status);
958+
if (!ENVIRONMENT_IS_WORKER) _exit(status);
959959
else PThread.threadExit(status);
960960
#if WASM_BACKEND
961961
// pthread_exit is marked noReturn, so we must not return from it.
@@ -996,7 +996,7 @@ var LibraryPThread = {
996996
emscripten_is_main_runtime_thread__sig: 'i',
997997
emscripten_is_main_runtime_thread__deps: ['_pthread_is_main_runtime_thread'],
998998
emscripten_is_main_runtime_thread: function() {
999-
return __pthread_is_main_runtime_thread|0; // Semantically the same as testing "!ENVIRONMENT_IS_PTHREAD" outside the asm.js scope
999+
return __pthread_is_main_runtime_thread|0; // Semantically the same as testing "!ENVIRONMENT_IS_WORKER" outside the asm.js scope
10001000
},
10011001

10021002
emscripten_is_main_browser_thread__asm: true,
@@ -1105,7 +1105,7 @@ var LibraryPThread = {
11051105
pthread_cleanup_push: function(routine, arg) {
11061106
if (PThread.exitHandlers === null) {
11071107
PThread.exitHandlers = [];
1108-
if (!ENVIRONMENT_IS_PTHREAD) {
1108+
if (!ENVIRONMENT_IS_WORKER) {
11091109
__ATEXIT__.push(function() { PThread.runExitHandlers(); });
11101110
}
11111111
}
@@ -1135,13 +1135,13 @@ var LibraryPThread = {
11351135
emscripten_futex_wait__deps: ['_main_thread_futex_wait_address', 'emscripten_main_thread_process_queued_calls'],
11361136
emscripten_futex_wait: function(addr, val, timeout) {
11371137
if (addr <= 0 || addr > HEAP8.length || addr&3 != 0) return -{{{ cDefine('EINVAL') }}};
1138-
// dump('futex_wait addr:' + addr + ' by thread: ' + _pthread_self() + (ENVIRONMENT_IS_PTHREAD?'(pthread)':'') + '\n');
1138+
// dump('futex_wait addr:' + addr + ' by thread: ' + _pthread_self() + (ENVIRONMENT_IS_WORKER?'(pthread)':'') + '\n');
11391139
if (ENVIRONMENT_IS_WORKER) {
11401140
#if PTHREADS_PROFILING
11411141
PThread.setThreadStatusConditional(_pthread_self(), {{{ cDefine('EM_THREAD_STATUS_RUNNING') }}}, {{{ cDefine('EM_THREAD_STATUS_WAITFUTEX') }}});
11421142
#endif
11431143
var ret = Atomics.wait(HEAP32, addr >> 2, val, timeout);
1144-
// dump('futex_wait done by thread: ' + _pthread_self() + (ENVIRONMENT_IS_PTHREAD?'(pthread)':'') + '\n');
1144+
// dump('futex_wait done by thread: ' + _pthread_self() + (ENVIRONMENT_IS_WORKER?'(pthread)':'') + '\n');
11451145
#if PTHREADS_PROFILING
11461146
PThread.setThreadStatusConditional(_pthread_self(), {{{ cDefine('EM_THREAD_STATUS_WAITFUTEX') }}}, {{{ cDefine('EM_THREAD_STATUS_RUNNING') }}});
11471147
#endif
@@ -1192,7 +1192,7 @@ var LibraryPThread = {
11921192
// Waking (at least) INT_MAX waiters is defined to mean wake all callers.
11931193
// For Atomics.notify() API Infinity is to be passed in that case.
11941194
if (count >= {{{ cDefine('INT_MAX') }}}) count = Infinity;
1195-
// dump('futex_wake addr:' + addr + ' by thread: ' + _pthread_self() + (ENVIRONMENT_IS_PTHREAD?'(pthread)':'') + '\n');
1195+
// dump('futex_wake addr:' + addr + ' by thread: ' + _pthread_self() + (ENVIRONMENT_IS_WORKER?'(pthread)':'') + '\n');
11961196

11971197
// See if main thread is waiting on this address? If so, wake it up by resetting its wake location to zero.
11981198
// Note that this is not a fair procedure, since we always wake main thread first before any workers, so

src/parseTools.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1573,7 +1573,7 @@ function modifyFunction(text, func) {
15731573

15741574
function runOnMainThread(text) {
15751575
if (USE_PTHREADS) {
1576-
return 'if (!ENVIRONMENT_IS_PTHREAD) { ' + text + ' }';
1576+
return 'if (!ENVIRONMENT_IS_WORKER) { ' + text + ' }';
15771577
} else {
15781578
return text;
15791579
}

0 commit comments

Comments
 (0)