]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
clocks: update gclk() each second
authorJaroslav Kysela <perex@perex.cz>
Tue, 5 Apr 2016 10:58:17 +0000 (12:58 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 5 Apr 2016 10:58:17 +0000 (12:58 +0200)
src/main.c

index acf87fa594bc29b78a50446b35e5fc6e0cdcbd94..4b794e009f6a2139422eb2a5a31b917118cb23a3 100644 (file)
@@ -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);
 }
@@ -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;
+}
+
 /**
  *
  */
@@ -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 */
   }
 
@@ -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;
-}
-
 /**
  *
  */