]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
change mi_running to atomic ops (clang)
authorJaroslav Kysela <perex@perex.cz>
Tue, 8 Mar 2016 19:32:58 +0000 (20:32 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Mar 2016 19:32:58 +0000 (20:32 +0100)
src/input/mpegts.h
src/input/mpegts/mpegts_input.c

index 7ec87f77bf19727d93e4676213c4a3a8e51efd84..3cc39557810b39cd04835db9d7c12f49a4a91bcc 100644 (file)
@@ -671,7 +671,7 @@ struct mpegts_input
    * Input processing
    */
 
-  uint8_t mi_running;            /* threads running */
+  int mi_running;            /* threads running */
   time_t mi_last_dispatch;
 
   /* Data input */
index 8da544dd2aa7fe43a9a312fa9f8ce7f6feec211f..9307800ad5363586144c3aa14b83dbb4e724fde5 100644 (file)
@@ -1451,7 +1451,7 @@ mpegts_input_thread ( void * p )
 
   mi->mi_display_name(mi, buf, sizeof(buf));
   pthread_mutex_lock(&mi->mi_input_lock);
-  while (mi->mi_running) {
+  while (atomic_get(&mi->mi_running)) {
 
     /* Wait for a packet */
     if (!(mp = TAILQ_FIRST(&mi->mi_input_queue))) {
@@ -1517,7 +1517,7 @@ mpegts_input_table_thread ( void *aux )
   char                   muxname[256];
 
   pthread_mutex_lock(&mi->mi_output_lock);
-  while (mi->mi_running) {
+  while (atomic_get(&mi->mi_running)) {
 
     /* Wait for data */
     if (!(mtf = TAILQ_FIRST(&mi->mi_table_queue))) {
@@ -1529,7 +1529,7 @@ mpegts_input_table_thread ( void *aux )
     
     /* Process */
     pthread_mutex_lock(&global_lock);
-    if (mi->mi_running) {
+    if (atomic_get(&mi->mi_running)) {
       if (mm != mtf->mtf_mux) {
         mm = mtf->mtf_mux;
         if (mm)
@@ -1684,7 +1684,7 @@ static void
 mpegts_input_thread_start ( void *aux )
 {
   mpegts_input_t *mi = aux;
-  mi->mi_running = 1;
+  atomic_set(&mi->mi_running, 1);
   
   tvhthread_create(&mi->mi_table_tid, NULL,
                    mpegts_input_table_thread, mi, "mi-table");
@@ -1695,7 +1695,7 @@ mpegts_input_thread_start ( void *aux )
 static void
 mpegts_input_thread_stop ( mpegts_input_t *mi )
 {
-  mi->mi_running = 0;
+  atomic_set(&mi->mi_running, 0);
   mtimer_disarm(&mi->mi_input_thread_start);
 
   /* Stop input thread */
@@ -1828,7 +1828,7 @@ mpegts_input_delete ( mpegts_input_t *mi, int delconf )
   tvh_input_instance_t *tii, *tii_next;
 
   /* Early shutdown flag */
-  mi->mi_running = 0;
+  atomic_set(&mi->mi_running, 0);
 
   idnode_save_check(&mi->ti_id, delconf);