Skip to content

Commit 33fea95

Browse files
committed
Skip wasmBinaryFile initialization on pthread workers
The fact that we were calling `locateFile` in an attempt to find the wasm binary on each worker was confusing at best. The wasm file is always received via postMessage when running on the worker. See #21826 and #21827
1 parent 4e7c86a commit 33fea95

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

src/preamble.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,12 @@ function instrumentWasmTableWithAbort() {
596596
}
597597
#endif
598598

599+
#if PTHREADS
600+
// We only need to locate the wasm binary on the main thread. Worker threads
601+
// receive the wasm module via postMessage instead.
602+
if (!ENVIRONMENT_IS_PTHREAD) {
603+
#endif
604+
599605
var wasmBinaryFile;
600606
#if EXPORT_ES6 && USE_ES6_IMPORT_META && !SINGLE_FILE && !AUDIO_WORKLET
601607
if (Module['locateFile']) {
@@ -618,6 +624,10 @@ if (Module['locateFile']) {
618624
}
619625
#endif
620626

627+
#if PTHREADS
628+
}
629+
#endif
630+
621631
function getBinarySync(file) {
622632
if (file == wasmBinaryFile && wasmBinary) {
623633
return new Uint8Array(wasmBinary);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5253
1+
5257
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
11457
1+
11469

0 commit comments

Comments
 (0)