]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
satip client: fix another dead-lock in satip_frontend_wake_other_waiting, fixes ...
authorJaroslav Kysela <perex@perex.cz>
Tue, 6 Jun 2017 08:54:30 +0000 (10:54 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 13 Jun 2017 15:28:27 +0000 (17:28 +0200)
src/input/mpegts/satip/satip.c
src/input/mpegts/satip/satip_frontend.c
src/input/mpegts/satip/satip_private.h

index f468981fe4956fbd2ee81df2b0b80e7a541eab6f..92d6562be08346ed338e631fbb264f444e63edd9 100644 (file)
@@ -604,7 +604,6 @@ satip_device_create( satip_device_info_t *info )
   sd->sd_sig_scale   = 240;
   sd->sd_dbus_allow  = 1;
 
-
   if (!tvh_hardware_create0((tvh_hardware_t*)sd, &satip_device_class,
                             uuid.hex, conf)) {
     /* Note: sd is freed in above fcn */
@@ -616,6 +615,8 @@ satip_device_create( satip_device_info_t *info )
   TAILQ_INIT(&sd->sd_frontends);
   TAILQ_INIT(&sd->sd_serialize_queue);
 
+  atomic_set(&sd->sd_wake_ref, 0);
+
   /* we may check if uuid matches, but the SHA hash should be enough */
   if (sd->sd_info.uuid)
     free(sd->sd_info.uuid);
index a6e1622261dab10ae27e54ed295cee1c46bda2b9..fb51008ef05af09101ec80377dcca05390bf6d27 100644 (file)
@@ -1085,6 +1085,9 @@ satip_frontend_wake_other_waiting
   if (tr == NULL)
     return;
 
+  if (atomic_add(&lfe->sf_device->sd_wake_ref, 1) > 0)
+    goto end;
+
   hash1 = tr->sf_netposhash;
 
   TAILQ_FOREACH(lfe2, &lfe->sf_device->sd_frontends, sf_link) {
@@ -1100,6 +1103,9 @@ satip_frontend_wake_other_waiting
       tvh_write(lfe2->sf_dvr_pipe.wr, "o", 1);
     pthread_mutex_unlock(&lfe2->sf_dvr_lock);
   }
+
+end:
+  atomic_dec(&lfe->sf_device->sd_wake_ref, 1);
 }
 
 static void
index 1955c379402ba954bc81296aeaecaf32d4c6e6cf..d32f032f102bb7a123bbccac8114ff71671802bd 100644 (file)
@@ -96,6 +96,7 @@ struct satip_device
   int                        sd_dbus_allow;
   int                        sd_skip_ts;
   int                        sd_disable_workarounds;
+  int                        sd_wake_ref;
   pthread_mutex_t            sd_tune_mutex;
   TAILQ_HEAD(,satip_frontend)sd_serialize_queue;
 };