Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
clocks: update gclk() each second
  • Loading branch information
perexg committed Apr 5, 2016
1 parent 07eb547 commit f6b3dfe
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions src/main.c
Expand Up @@ -212,6 +212,7 @@ doexit(int x)
if (pthread_self() != main_tid)
pthread_kill(main_tid, SIGTERM);
pthread_cond_signal(&gtimer_cond);
tvh_cond_signal(&mtimer_cond, 1);
atomic_set(&tvheadend_running, 0);
signal(x, doexit);
}
Expand Down Expand Up @@ -531,6 +532,17 @@ show_usage
exit(0);
}

/**
*
*/
static inline time_t
gdispatch_clock_update(void)
{
time_t now = time(NULL);
atomic_set_time_t(&__gdispatch_clock, now);
return now;
}

/**
*
*/
Expand All @@ -541,6 +553,7 @@ mdispatch_clock_update(void)

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 */
}

Expand Down Expand Up @@ -623,17 +636,6 @@ mtimer_thread(void *aux)
return NULL;
}

/**
*
*/
static inline time_t
gdispatch_clock_update(void)
{
time_t now = time(NULL);
atomic_set_time_t(&__gdispatch_clock, now);
return now;
}

/**
*
*/
Expand Down

0 comments on commit f6b3dfe

Please sign in to comment.