MCPcopy Create free account
hub / github.com/acl-dev/acl / event_timer_trigger

Function event_timer_trigger

lib_acl/src/event/events_timer.c:274–316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274void event_timer_trigger(ACL_EVENT *eventp)
275{
276 ACL_RING *ring;
277 ACL_EVENT_NOTIFY_TIME timer_fn;
278 void *timer_arg;
279 TIMER_NODE *iter;
280 TIMER_INFO *info;
281
282 SET_TIME(eventp->present);
283
284 /* collect all the timers that should be triggered */
285 iter = acl_avl_first(&eventp->timers->avl);
286 while (iter) {
287 if (iter->when > eventp->present) {
288 break;
289 }
290 info = iter->head;
291 while (info) {
292 acl_ring_prepend(&eventp->timers_ready, &info->tmp);
293 info = info->next;
294 }
295 iter = AVL_NEXT(&eventp->timers->avl, iter);
296 }
297
298#define TMP_TO_INFO(r) \
299 ((TIMER_INFO *) ((char *) (r) - offsetof(TIMER_INFO, tmp)))
300
301 while ((ring = acl_ring_pop_head(&eventp->timers_ready)) != NULL) {
302 info = TMP_TO_INFO(ring);
303 timer_fn = info->callback;
304 timer_arg = info->context;
305
306 if (info->delay > 0 && info->keep) {
307 acl_ring_detach(&info->tmp);
308 event_timer_request(eventp, timer_fn,
309 timer_arg, info->delay, info->keep);
310 } else {
311 timer_cancel(eventp, info);
312 }
313
314 timer_fn(ACL_EVENT_TIME, eventp, timer_arg);
315 }
316}

Callers 5

event_loopFunction · 0.85
event_loopFunction · 0.85
events_poll.cFile · 0.85
event_loopFunction · 0.85
event_timer_trigger_thrFunction · 0.85

Calls 7

acl_avl_firstFunction · 0.85
acl_ring_prependFunction · 0.85
acl_ring_pop_headFunction · 0.85
acl_ring_detachFunction · 0.85
event_timer_requestFunction · 0.85
timer_fnFunction · 0.85
timer_cancelFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…