MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxRunLoop

Function fxRunLoop

xs/tools/xst.c:972–1012  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

970}
971
972void fxRunLoop(txMachine* the)
973{
974 txThread thread = mxCurrentThread();
975 txNumber when;
976 txInteger count;
977 txSharedTimer* timer;
978
979 for (;;) {
980 fxEndJob(the);
981 while (the->promiseJobs) {
982 while (the->promiseJobs) {
983 the->promiseJobs = 0;
984 fxRunPromiseJobs(the);
985 }
986 fxEndJob(the);
987 }
988 when = mxMonotonicNow();
989 fxLockMutex(&(gxSharedTimers.mutex));
990 count = 0;
991 timer = gxSharedTimers.first;
992 while (timer) {
993 if (timer->thread == thread) {
994 count++;
995 if (timer->when <= when)
996 break; // one timer at time to run promise jobs queued by the timer in the same "tick"
997 }
998 timer = timer->next;
999 }
1000 fxUnlockMutex(&(gxSharedTimers.mutex));
1001 if (timer) {
1002 (timer->callback)(timer, timer->refcon, timer->refconSize);
1003 if (timer->interval == 0)
1004 fxUnscheduleSharedTimer(timer);
1005 else
1006 timer->when += timer->interval;
1007 continue;
1008 }
1009 if (count == 0)
1010 break;
1011 }
1012}
1013
1014void fxFulfillModuleFile(txMachine* the)
1015{

Callers 6

fuzzFunction · 0.85
fuzz_ossFunction · 0.85
mainFunction · 0.85
fxRunBundleFunction · 0.85
fx_agent_start_auxFunction · 0.85
fxRunTestCaseFunction · 0.85

Calls 3

fxEndJobFunction · 0.85
fxRunPromiseJobsFunction · 0.85
fxUnscheduleSharedTimerFunction · 0.85

Tested by

no test coverage detected