From: Jaroslav Kysela Date: Tue, 8 Mar 2016 19:49:59 +0000 (+0100) Subject: change ths_total_err to atomic ops X-Git-Tag: v4.2.1~923 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2f7e1275050715c66d783df4428cb3f649ffbc2;p=thirdparty%2Ftvheadend.git change ths_total_err to atomic ops --- diff --git a/src/epggrab/module/eit.c b/src/epggrab/module/eit.c index 24e257535..df3f881d6 100644 --- a/src/epggrab/module/eit.c +++ b/src/epggrab/module/eit.c @@ -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; } diff --git a/src/subscriptions.c b/src/subscriptions.c index 54d2eab40..8831c4846 100644 --- a/src/subscriptions.c +++ b/src/subscriptions.c @@ -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) {