Skip to content

Commit c062d80

Browse files
committed
Fix async futex wait in WASM worker dose not keep runtime alive
Fix asynchronous futex wait `emscripten_atomic_wait_async` in WASM worker dose not keep runtime alive.
1 parent 0c21eb9 commit c062d80

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/library_wasm_worker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,12 @@ Atomics.waitAsync = (i32a, index, value, maxWaitMilliseconds) => {
300300
// application does huge amounts of waitAsyncs per second (not sure if
301301
// possible?)
302302
// Valid counterrange: 0...2^31-1
303+
{{{ runtimeKeepalivePush() }}}
303304
let counter = liveAtomicWaitAsyncCounter;
304305
liveAtomicWaitAsyncCounter = Math.max(0, (liveAtomicWaitAsyncCounter+1)|0);
305306
liveAtomicWaitAsyncs[counter] = addr;
306307
wait.value.then((value) => {
308+
{{{ runtimeKeepalivePop() }}}
307309
if (liveAtomicWaitAsyncs[counter]) {
308310
delete liveAtomicWaitAsyncs[counter];
309311
{{{ makeDynCall('vpiip', 'asyncWaitFinished') }}}(addr, val, atomicWaitStates.indexOf(value), userData);

0 commit comments

Comments
 (0)