Skip to content

Commit 8197e93

Browse files
authored
Merge pull request #6085 from juj/drop_pthread_entrypoint_sig_hack
Multithreading 18/N: drop_pthread_entrypoint_sig_hack
2 parents 08ccc11 + ae69137 commit 8197e93

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/pthread-main.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ this.onmessage = function(e) {
112112
} else if (e.data.cmd === 'objectTransfer') {
113113
PThread.receiveObjectTransfer(e.data);
114114
} else if (e.data.cmd === 'run') { // This worker was idle, and now should start executing its pthread entry point.
115-
__performance_now_clock_drift = performance.now() - e.data.time; // Sync up to the clock of the main thread.
115+
__performance_now_clock_drift = performance.now() - e.data.time; // Sync up to the clock of the main thread.
116116
threadInfoStruct = e.data.threadInfoStruct;
117117
__register_pthread_ptr(threadInfoStruct, /*isMainBrowserThread=*/0, /*isMainRuntimeThread=*/0); // Pass the thread address inside the asm.js scope to store it for fast access that avoids the need for a FFI out.
118118
assert(threadInfoStruct);
@@ -136,14 +136,14 @@ this.onmessage = function(e) {
136136
PThread.setThreadStatus(_pthread_self(), 1/*EM_THREAD_STATUS_RUNNING*/);
137137

138138
try {
139-
// pthread entry points are always of signature 'void *ThreadMain(void *arg)'
140-
// Native codebases sometimes spawn threads with other thread entry point signatures,
141-
// such as void ThreadMain(void *arg), void *ThreadMain(), or void ThreadMain().
142-
// That is not acceptable per C/C++ specification, but x86 compiler ABI extensions
143-
// enable that to work. If you find the following line to crash, either change the signature
144-
// to "proper" void *ThreadMain(void *arg) form, or try linking with the Emscripten linker
145-
// flag -s EMULATE_FUNCTION_POINTER_CASTS=1 to add in emulation for this x86 ABI extension.
146-
result = Module['asm'].dynCall_ii(e.data.start_routine, e.data.arg);
139+
// pthread entry points are always of signature 'void *ThreadMain(void *arg)'
140+
// Native codebases sometimes spawn threads with other thread entry point signatures,
141+
// such as void ThreadMain(void *arg), void *ThreadMain(), or void ThreadMain().
142+
// That is not acceptable per C/C++ specification, but x86 compiler ABI extensions
143+
// enable that to work. If you find the following line to crash, either change the signature
144+
// to "proper" void *ThreadMain(void *arg) form, or try linking with the Emscripten linker
145+
// flag -s EMULATE_FUNCTION_POINTER_CASTS=1 to add in emulation for this x86 ABI extension.
146+
result = Module['asm'].dynCall_ii(e.data.start_routine, e.data.arg);
147147

148148
//#if STACK_OVERFLOW_CHECK
149149
if (typeof checkStackCookie === 'function') checkStackCookie();

0 commit comments

Comments
 (0)