static int64_t mdispatch_clock_update(void) { int64_t mono = getmonoclock(); if (mono > atomic_get_s64(&mtimer_periodic)) { atomic_set_s64(&mtimer_periodic, mono + MONOCLOCK_RESOLUTION); gdispatch_clock_update(); /* gclk() update */ comet_flush(); /* Flush idle comet mailboxes */ } atomic_set_s64(&__mdispatch_clock, mono); return mono; }
static void * mtimer_tick_thread(void *aux) { while (tvheadend_is_running()) { /* update clocks each 10x in one second */ atomic_set_s64(&__mdispatch_clock, getmonoclock()); tvh_safe_usleep(100000); } return NULL; }