Skip to content

Commit e097cb6

Browse files
committed
feedback
1 parent c14c1a9 commit e097cb6

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/library_wasm_worker.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ addToLibrary({
142142
'$_wasmWorkerAppendToQueue', '$_wasmWorkerRunPostMessage',
143143
#if WASM_WORKERS == 2
144144
'$_wasmWorkerBlobUrl',
145+
#endif
146+
#if ASSERTIONS
147+
'emscripten_has_threading_support',
145148
#endif
146149
],
147150
_emscripten_create_wasm_worker__postset: `
@@ -155,12 +158,12 @@ if (ENVIRONMENT_IS_WASM_WORKER
155158
addEventListener("message", _wasmWorkerAppendToQueue);
156159
}`,
157160
_emscripten_create_wasm_worker: (stackLowestAddress, stackSize) => {
158-
if (typeof SharedArrayBuffer == 'undefined') {
159161
#if ASSERTIONS
160-
dbg('create_wasm_worker: environment does not support SharedArrayBuffer, wasm workers are not available');
161-
#endif
162+
if (!_emscripten_has_threading_support()) {
163+
err('create_wasm_worker: environment does not support SharedArrayBuffer, wasm workers are not available');
162164
return 0;
163165
}
166+
#endif
164167
let worker = _wasmWorkers[_wasmWorkersID] = new Worker(
165168
#if WASM_WORKERS == 2
166169
// WASM_WORKERS=2 mode embeds .ww.js file contents into the main .js file

test/code_size/hello_wasm_worker_wasm.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ c && (m[0] = this, addEventListener("message", l));
1515
WebAssembly.instantiate(b.wasm, {
1616
a: {
1717
b: (a, d) => {
18-
if ("undefined" == typeof SharedArrayBuffer) return 0;
1918
let r = m[n] = new Worker(b.$wb);
2019
r.postMessage({
2120
$ww: n,
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"a.html": 618,
33
"a.html.gz": 384,
4-
"a.js": 715,
5-
"a.js.gz": 484,
4+
"a.js": 665,
5+
"a.js.gz": 455,
66
"a.ww.js": 115,
77
"a.ww.js.gz": 127,
88
"a.wasm": 1850,
99
"a.wasm.gz": 1050,
10-
"total": 3298,
11-
"total_gz": 2045
10+
"total": 3248,
11+
"total_gz": 2016
1212
}

0 commit comments

Comments
 (0)