Skip to content

Commit

Permalink
fix: run-loop behavior
Browse files Browse the repository at this point in the history
Drain promise queue after host job, then run finalizers
Repeat if needed
  • Loading branch information
mhofman committed Feb 7, 2023
1 parent 2411e26 commit 2a42752
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xsnap/sources/xsnapPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ void fxRunLoop(txMachine* the)
txNumber when;
txJob* job;
txJob** address;
fxEndJob(the);
for (;;) {
while (the->promiseJobs) {
while (the->promiseJobs) {
the->promiseJobs = 0;
fxRunPromiseJobs(the);
}
fxEndJob(the);
the->promiseJobs = 0;
fxRunPromiseJobs(the);
}
fxEndJob(the);
if (the->promiseJobs) {
continue;
}
c_gettimeofday(&tv, NULL);
when = ((txNumber)(tv.tv_sec) * 1000.0) + ((txNumber)(tv.tv_usec) / 1000.0);
Expand Down

0 comments on commit 2a42752

Please sign in to comment.