@@ -323,10 +323,9 @@ addToLibrary({
323323 // can just call the function with no args at all since the engine will produce zeros
324324 // for all arguments. However, for i64 arguments we get `undefined cannot be converted to
325325 // BigInt`.
326- return func ( ...Asyncify . restoreRewindArguments ( original ) ) ;
327- #else
328- return func ( ) ;
326+ func = func . bind ( 0 , ...Asyncify . restoreRewindArguments ( original ) ) ;
329327#endif
328+ return callUserCallback ( func ) ;
330329 } ,
331330
332331 // This receives a function to call to start the async operation, and
@@ -480,9 +479,8 @@ addToLibrary({
480479#endif
481480 } ,
482481
483- emscripten_sleep__deps : [ '$safeSetTimeout' ] ,
484482 emscripten_sleep__async : true ,
485- emscripten_sleep : ( ms ) => Asyncify . handleSleep ( ( wakeUp ) => safeSetTimeout ( wakeUp , ms ) ) ,
483+ emscripten_sleep : ( ms ) => Asyncify . handleSleep ( ( wakeUp ) => setTimeout ( wakeUp , ms ) ) ,
486484
487485 emscripten_wget_data__deps : [ '$asyncLoad' , 'malloc' ] ,
488486 emscripten_wget_data__async : 'auto' ,
@@ -501,15 +499,14 @@ addToLibrary({
501499 }
502500 } ,
503501
504- emscripten_scan_registers__deps : [ '$safeSetTimeout' ] ,
505502 emscripten_scan_registers__async : true ,
506503 emscripten_scan_registers : ( func ) => {
507504 return Asyncify . handleSleep ( ( wakeUp ) => {
508505 // We must first unwind, so things are spilled to the stack. Then while
509506 // we are pausing we do the actual scan. After that we can resume. Note
510507 // how using a timeout here avoids unbounded call stack growth, which
511508 // could happen if we tried to scan the stack immediately after unwinding.
512- safeSetTimeout ( ( ) => {
509+ setTimeout ( ( ) => {
513510 var stackBegin = Asyncify . currData + { { { C_STRUCTS . asyncify_data_s . __size__ } } } ;
514511 var stackEnd = { { { makeGetValue ( 'Asyncify.currData' , 0 , '*' ) } } } ;
515512 { { { makeDynCall ( 'vpp' , 'func' ) } } } ( stackBegin , stackEnd ) ;
0 commit comments