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

Function modTimerAdd

modules/base/timer/mc/timer.c:139–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139modTimer modTimerAdd(int firstInterval, int secondInterval, modTimerCallback cb, void *refcon, int refconSize)
140{
141 modCriticalSectionDeclare;
142 modTimer timer;
143
144 timer = c_malloc(sizeof(modTimerRecord) + refconSize - 1);
145 if (!timer) return NULL;
146
147 timer->next = NULL;
148 timer->triggerTime = modMilliseconds() + firstInterval;
149 timer->repeatInterval = secondInterval;
150 timer->flags = 0;
151 timer->useCount = 1;
152 timer->cb = cb;
153#if MOD_TASKS
154 timer->task = modTaskGetCurrent();
155#endif
156 timer->refconSize = refconSize;
157 c_memmove(timer->refcon, refcon, refconSize);
158
159 modCriticalSectionBegin();
160
161 if (!gTimers)
162 gTimers = timer;
163 else {
164 modTimer walker;
165
166 for (walker = gTimers; walker->next; walker = walker->next)
167 ;
168 walker->next = timer;
169 }
170
171 modCriticalSectionEnd();
172
173 modInstrumentationAdjust(Timers, +1);
174
175 return timer;
176}
177
178void modTimerReschedule(modTimer timer, int firstInterval, int secondInterval)
179{

Callers 15

xs_audioout_startFunction · 0.50
xs_socketmbedtlsFunction · 0.50
xs_ble_server_initializeFunction · 0.50
xs_ble_client_initializeFunction · 0.50
xs_wifi_connectFunction · 0.50
xs_socketFunction · 0.50
xs_LS013B4DN04Function · 0.50
xs_sensor_startFunction · 0.50
xs_serial_constructorFunction · 0.50
xs_serial_writeFunction · 0.50
fxSerialFlushFunction · 0.50
xs_audioout_start_Function · 0.50

Calls 1

modMillisecondsFunction · 0.85

Tested by

no test coverage detected