@@ -292,18 +292,24 @@ Atomics.waitAsync = (i32a, index, value, maxWaitMilliseconds) => {
292
292
$liveAtomicWaitAsyncs : '{}' ,
293
293
$liveAtomicWaitAsyncCounter : '0' ,
294
294
295
- emscripten_atomic_wait_async__deps : [ '$atomicWaitStates' , '$liveAtomicWaitAsyncs' , '$liveAtomicWaitAsyncCounter' , '$jstoi_q' ] ,
295
+ emscripten_atomic_wait_async__deps : [ '$atomicWaitStates' , '$liveAtomicWaitAsyncs' , '$liveAtomicWaitAsyncCounter' , '$jstoi_q' ,
296
+ #if ! MINIMAL_RUNTIME
297
+ '$runtimeKeepalivePush' , '$runtimeKeepalivePop' ,
298
+ #endif
299
+ ] ,
296
300
emscripten_atomic_wait_async : ( addr , val , asyncWaitFinished , userData , maxWaitMilliseconds ) => {
297
301
let wait = Atomics . waitAsync ( HEAP32 , { { { getHeapOffset ( 'addr' , 'i32' ) } } } , val , maxWaitMilliseconds ) ;
298
302
if ( ! wait . async ) return atomicWaitStates . indexOf ( wait . value ) ;
299
303
// Increment waitAsync generation counter, account for wraparound in case
300
304
// application does huge amounts of waitAsyncs per second (not sure if
301
305
// possible?)
302
306
// Valid counterrange: 0...2^31-1
307
+ { { { runtimeKeepalivePush ( ) } } }
303
308
let counter = liveAtomicWaitAsyncCounter ;
304
309
liveAtomicWaitAsyncCounter = Math . max ( 0 , ( liveAtomicWaitAsyncCounter + 1 ) | 0 ) ;
305
310
liveAtomicWaitAsyncs [ counter ] = addr ;
306
311
wait . value . then ( ( value ) => {
312
+ { { { runtimeKeepalivePop ( ) } } }
307
313
if ( liveAtomicWaitAsyncs [ counter ] ) {
308
314
delete liveAtomicWaitAsyncs [ counter ] ;
309
315
{ { { makeDynCall ( 'vpiip' , 'asyncWaitFinished' ) } } } ( addr , val , atomicWaitStates . indexOf ( value ) , userData ) ;
0 commit comments