Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/postamble_minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function run() {
#endif

function initRuntime(wasmExports) {
#if ASSERTIONS || SAFE_HEAP || USE_ASAN || MODULARIZE
#if ASSERTIONS || SAFE_HEAP || USE_ASAN || MODULARIZE || PTHREADS
runtimeInitialized = true;
#endif

Expand Down
2 changes: 1 addition & 1 deletion src/runtime_common.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if (ENVIRONMENT_IS_NODE && {{{ ENVIRONMENT_IS_WORKER_THREAD() }}}) {
var HEAP_DATA_VIEW;
#endif

#if !MINIMAL_RUNTIME || ASSERTIONS || SAFE_HEAP || USE_ASAN || MODULARIZE
#if !MINIMAL_RUNTIME || ASSERTIONS || SAFE_HEAP || USE_ASAN || MODULARIZE || PTHREADS
var runtimeInitialized = false;
#endif

Expand Down
5 changes: 4 additions & 1 deletion src/runtime_pthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ if (ENVIRONMENT_IS_PTHREAD) {
} else if (cmd == {{{ CMD_RUN }}}) {
#if ASSERTIONS
assert(msgData.pthread_ptr);
#if !WASM_ESM_INTEGRATION
assert(wasmMemory, "CMD_RUN received before CMD_LOAD");
#endif
#endif
// Call inside JS module to set up the stack frame for this pthread in JS module scope.
// This needs to be the first thing that we do, as we cannot call to any C/C++ functions
Expand Down Expand Up @@ -190,7 +193,7 @@ if (ENVIRONMENT_IS_PTHREAD) {
err(`worker: onmessage() captured an uncaught exception: ${ex}`);
if (ex?.stack) err(ex.stack);
#endif
__emscripten_thread_crashed();
if (runtimeInitialized) __emscripten_thread_crashed();
throw ex;
}
};
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 6949,
"a.out.js.gz": 3427,
"a.out.js": 6969,
"a.out.js.gz": 3438,
"a.out.nodebug.wasm": 19063,
"a.out.nodebug.wasm.gz": 8803,
"total": 26012,
"total_gz": 12230,
"total": 26032,
"total_gz": 12241,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
8 changes: 4 additions & 4 deletions test/codesize/test_codesize_minimal_pthreads_memgrowth.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"a.out.js": 7357,
"a.out.js.gz": 3627,
"a.out.js": 7377,
"a.out.js.gz": 3640,
"a.out.nodebug.wasm": 19064,
"a.out.nodebug.wasm.gz": 8804,
"total": 26421,
"total_gz": 12431,
"total": 26441,
"total_gz": 12444,
"sent": [
"a (memory)",
"b (exit)",
Expand Down
Loading