Skip to content

Commit 18fd850

Browse files
committed
Remove duplicate threadExit code in worke.js
As
1 parent 45aa70c commit 18fd850

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/worker.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,10 @@ this.onmessage = function(e) {
205205
} else if (ex != 'unwind') {
206206
#if MINIMAL_RUNTIME
207207
// ExitStatus not present in MINIMAL_RUNTIME
208-
Atomics.store(Module['HEAPU32'], (threadInfoStruct + {{{ C_STRUCTS.pthread.threadExitCode }}} ) >> 2, -2 /*A custom entry specific to Emscripten denoting that the thread crashed.*/);
209-
#else
210-
Atomics.store(Module['HEAPU32'], (threadInfoStruct + {{{ C_STRUCTS.pthread.threadExitCode }}} ) >> 2, (ex instanceof Module['ExitStatus']) ? ex.status : -2 /*A custom entry specific to Emscripten denoting that the thread crashed.*/);
211-
#endif
212-
213-
Atomics.store(Module['HEAPU32'], (threadInfoStruct + {{{ C_STRUCTS.pthread.threadStatus }}} ) >> 2, 1); // Mark the thread as no longer running.
214-
#if ASSERTIONS
215-
if (typeof(Module['_emscripten_futex_wake']) !== "function") {
216-
err("Thread Initialisation failed.");
217-
throw ex;
218-
}
219-
#endif
220-
Module['_emscripten_futex_wake'](threadInfoStruct + {{{ C_STRUCTS.pthread.threadStatus }}}, 0x7FFFFFFF/*INT_MAX*/); // Wake all threads waiting on this thread to finish.
221-
#if MINIMAL_RUNTIME
208+
Module['PThread'].threadExit(-2);
222209
throw ex; // ExitStatus not present in MINIMAL_RUNTIME
223210
#else
211+
Module['PThread'].threadExit((ex instanceof Module['ExitStatus']) ? ex.status : -2);
224212
if (!(ex instanceof Module['ExitStatus'])) throw ex;
225213
#endif
226214
#if ASSERTIONS

0 commit comments

Comments
 (0)