MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / utimer_ticker

Function utimer_ticker

timer.c:471–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469
470
471static inline void utimer_ticker(struct os_timer *utlist)
472{
473 struct os_timer* t;
474 utime_t uj;
475 ssize_t l;
476
477 /* see comment on timer_ticket */
478 uj = *ujiffies;
479
480 for ( t=utlist ; t ; t=t->next){
481 if (uj < t->expires)
482 continue;
483
484 if (t->trigger_time) {
485 LM_WARN("utimer task <%s> already scheduled %lld ms ago"
486 " (now %lld ms), %s\n", t->label, ((utime_t)*ijiffies/1000) -
487 (utime_t)(t->trigger_time/1000), ((utime_t)*ijiffies/1000),
488 t->flags&TIMER_FLAG_SKIP_ON_DELAY ? "skipping execution" :
489 t->flags&TIMER_FLAG_DELAY_ON_DELAY ? "delaying execution" :
490 "pushing a new one");
491
492 if (t->flags&TIMER_FLAG_SKIP_ON_DELAY) {
493 /* skip this execution of the timer handler */
494 t->expires = uj + t->interval;
495 continue;
496 } else if (t->flags&TIMER_FLAG_DELAY_ON_DELAY) {
497 /* delay the execution of the timer handler
498 until the prev one is done */
499 continue;
500 } else {
501 /* launch the task now, even if overlapping with the
502 already running one */
503 }
504 }
505 t->expires = uj + t->interval;
506 t->trigger_time = *ijiffies;
507 t->time = uj;
508 /* push the jobs for execution */
509again:
510 l = write( timer_pipe[1], &t, sizeof(t));
511 if (l==-1) {
512 if (errno==EAGAIN || errno==EINTR || errno==EWOULDBLOCK )
513 goto again;
514 LM_ERR("writing failed:[%d] %s, skipping job <%s> at %lld us\n",
515 errno, strerror(errno),t->label, uj);
516 }
517 }
518}
519
520
521static void run_timer_process( void )

Callers 1

run_timer_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected