]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
change ths_total_err to atomic ops
authorJaroslav Kysela <perex@perex.cz>
Tue, 8 Mar 2016 19:49:59 +0000 (20:49 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 8 Mar 2016 19:49:59 +0000 (20:49 +0100)
src/epggrab/module/eit.c
src/subscriptions.c

index 24e257535e06e9ec0b68ca4fc1c3cf4d5898af77..df3f881d6153c1a44ec43f73c2c00cca988f825f 100644 (file)
@@ -637,7 +637,7 @@ _eit_callback
   /* Validate */
   if(tableid < 0x4e || tableid > 0x6f || len < 11) {
     if (ths)
-      ths->ths_total_err++;
+      atomic_add(&ths->ths_total_err, 1);
     return -1;
   }
 
index 54d2eab40b9c5d8af527e8c5f9d14f38759d1b73..8831c4846c3dfdb9e0f74e4d3853d75b18a03a63 100644 (file)
@@ -471,12 +471,12 @@ subscription_input_direct(void *opauqe, streaming_message_t *sm)
   /* Log data and errors */
   if(sm->sm_type == SMT_PACKET) {
     th_pkt_t *pkt = sm->sm_data;
-    s->ths_total_err += pkt->pkt_err;
+    atomic_add(&s->ths_total_err, pkt->pkt_err);
     if (pkt->pkt_payload)
       subscription_add_bytes_in(s, pkt->pkt_payload->pb_size);
   } else if(sm->sm_type == SMT_MPEGTS) {
     pktbuf_t *pb = sm->sm_data;
-    s->ths_total_err += pb->pb_err;
+    atomic_add(&s->ths_total_err, pb->pb_err);
     subscription_add_bytes_in(s, pb->pb_size);
   }
 
@@ -701,12 +701,12 @@ subscription_create
   s->ths_hostname          = hostname ? strdup(hostname) : NULL;
   s->ths_username          = username ? strdup(username) : NULL;
   s->ths_client            = client   ? strdup(client)   : NULL;
-  s->ths_total_err         = 0;
   s->ths_output            = st;
   s->ths_flags             = flags;
   s->ths_timeout           = pro ? pro->pro_timeout : 0;
   s->ths_postpone          = subscription_postpone;
   s->ths_postpone_end      = mclk() + sec2mono(s->ths_postpone);
+  atomic_set(&s->ths_total_err, 0);
 
   if (s->ths_prch)
     s->ths_weight = profile_chain_weight(s->ths_prch, weight);
@@ -886,7 +886,7 @@ subscription_create_msg(th_subscription_t *s, const char *lang)
 
   htsmsg_add_u32(m, "id", s->ths_id);
   htsmsg_add_u32(m, "start", s->ths_start);
-  htsmsg_add_u32(m, "errors", s->ths_total_err);
+  htsmsg_add_u32(m, "errors", atomic_get(&s->ths_total_err));
 
   const char *state;
   switch(s->ths_state) {