Remove duplicate threadExit code in worke.js (#12931)

This commit is contained in:
Sam Clegg 2020-12-01 15:47:13 -08:00 коммит произвёл GitHub
Родитель ead1eddb20
Коммит bd9b27193a
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 7 добавлений и 9 удалений

Просмотреть файл

@ -203,24 +203,22 @@ this.onmessage = function(e) {
if (ex === 'Canceled!') {
Module['PThread'].threadCancel();
} else if (ex != 'unwind') {
#if MINIMAL_RUNTIME
// ExitStatus not present in MINIMAL_RUNTIME
Atomics.store(Module['HEAPU32'], (threadInfoStruct + {{{ C_STRUCTS.pthread.threadExitCode }}} ) >> 2, -2 /*A custom entry specific to Emscripten denoting that the thread crashed.*/);
#else
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.*/);
#endif
Atomics.store(Module['HEAPU32'], (threadInfoStruct + {{{ C_STRUCTS.pthread.threadStatus }}} ) >> 2, 1); // Mark the thread as no longer running.
#if ASSERTIONS
// FIXME(sbc): Figure out if this is still needed or useful. Its not
// clear to me how this check could ever fail. In order to get into
// this try/catch block at all we have already called bunch of
// functions on `Module`.. why is this one special?
if (typeof(Module['_emscripten_futex_wake']) !== "function") {
err("Thread Initialisation failed.");
throw ex;
}
#endif
Module['_emscripten_futex_wake'](threadInfoStruct + {{{ C_STRUCTS.pthread.threadStatus }}}, 0x7FFFFFFF/*INT_MAX*/); // Wake all threads waiting on this thread to finish.
#if MINIMAL_RUNTIME
// ExitStatus not present in MINIMAL_RUNTIME
Module['PThread'].threadExit(-2);
throw ex; // ExitStatus not present in MINIMAL_RUNTIME
#else
Module['PThread'].threadExit((ex instanceof Module['ExitStatus']) ? ex.status : -2);
if (!(ex instanceof Module['ExitStatus'])) throw ex;
#endif
#if ASSERTIONS