From 3cfa91601092e177aeca5274bdcb7b4fa825ca5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96man?= Date: Sat, 29 Sep 2007 14:43:00 +0000 Subject: [PATCH] get rid of the subscription_mutex it's not needed anymore --- dvb.c | 12 +----------- subscriptions.c | 37 ------------------------------------- subscriptions.h | 4 ---- transports.c | 2 -- 4 files changed, 1 insertion(+), 54 deletions(-) diff --git a/dvb.c b/dvb.c index 2d017996..ed0258b8 100644 --- a/dvb.c +++ b/dvb.c @@ -935,8 +935,6 @@ dvb_fec_monitor(void *aux) v = 0; tdmi->tdmi_fec_err_per_sec = (tdmi->tdmi_fec_err_per_sec * 7 + v) / 8; - subscription_lock(); - if(tdmi->tdmi_fec_err_per_sec > DVB_FEC_ERROR_LIMIT) { if(LIST_FIRST(&tda->tda_transports) != NULL) { @@ -952,7 +950,6 @@ dvb_fec_monitor(void *aux) LIST_REMOVE(tdmi, tdmi_mux_link); LIST_INSERT_SORTED(&tdm->tdm_instances, tdmi, tdmi_mux_link, mux_sort_quality); - subscription_unlock(); } } @@ -966,17 +963,10 @@ dvb_mux_scanner(void *aux) { th_dvb_adapter_t *tda = aux; th_dvb_mux_instance_t *tdmi; - unsigned int w; stimer_add(dvb_mux_scanner, tda, 10); - subscription_lock(); - - w = transport_compute_weight(&tda->tda_transports); - - subscription_unlock(); - - if(w > 0) + if(transport_compute_weight(&tda->tda_transports) > 0) return; /* someone is here */ tdmi = tda->tda_mux_current; diff --git a/subscriptions.c b/subscriptions.c index df87f684..547e7a76 100644 --- a/subscriptions.c +++ b/subscriptions.c @@ -48,28 +48,6 @@ #include "iptv_input.h" #include "psi.h" -/* - * subscriptions_mutex protects all operations concerning subscription lists - */ - -static pthread_mutex_t subscription_mutex = PTHREAD_MUTEX_INITIALIZER; - -/* - * - */ -void -subscription_lock(void) -{ - pthread_mutex_lock(&subscription_mutex); -} - -void -subscription_unlock(void) -{ - pthread_mutex_unlock(&subscription_mutex); -} - - struct th_subscription_list subscriptions; static void @@ -99,10 +77,7 @@ static void auto_reschedule(void *aux) { stimer_add(auto_reschedule, NULL, 10); - - pthread_mutex_lock(&subscription_mutex); subscription_reschedule(); - pthread_mutex_unlock(&subscription_mutex); } @@ -112,8 +87,6 @@ auto_reschedule(void *aux) void subscription_unsubscribe(th_subscription_t *s) { - pthread_mutex_lock(&subscription_mutex); - s->ths_callback(s, NULL, NULL, AV_NOPTS_VALUE); LIST_REMOVE(s, ths_global_link); @@ -131,8 +104,6 @@ subscription_unsubscribe(th_subscription_t *s) free(s); subscription_reschedule(); - - pthread_mutex_unlock(&subscription_mutex); } @@ -155,8 +126,6 @@ subscription_create(th_channel_t *ch, void *opaque, { th_subscription_t *s; - pthread_mutex_lock(&subscription_mutex); - s = malloc(sizeof(th_subscription_t)); s->ths_pkt = NULL; s->ths_callback = callback; @@ -179,8 +148,6 @@ subscription_create(th_channel_t *ch, void *opaque, "to channel \"%s\"", s->ths_title, s->ths_channel->ch_name); - pthread_mutex_unlock(&subscription_mutex); - return s; } @@ -190,15 +157,11 @@ subscription_set_weight(th_subscription_t *s, unsigned int weight) if(s->ths_weight == weight) return; - pthread_mutex_lock(&subscription_mutex); - LIST_REMOVE(s, ths_global_link); s->ths_weight = weight; LIST_INSERT_SORTED(&subscriptions, s, ths_global_link, subscription_sort); subscription_reschedule(); - - pthread_mutex_unlock(&subscription_mutex); } diff --git a/subscriptions.h b/subscriptions.h index c90bb2a5..4e37185e 100644 --- a/subscriptions.h +++ b/subscriptions.h @@ -25,10 +25,6 @@ void subscription_unsubscribe(th_subscription_t *s); void subscription_set_weight(th_subscription_t *s, unsigned int weight); -void subscription_lock(void); - -void subscription_unlock(void); - typedef void (subscription_callback_t)(struct th_subscription *s, uint8_t *pkt, th_pid_t *pi, int64_t pcr); diff --git a/transports.c b/transports.c index d7bd9e07..8c1bdc6b 100644 --- a/transports.c +++ b/transports.c @@ -255,12 +255,10 @@ transport_recv_tsb(th_transport_t *t, int pid, uint8_t *tsb, int scanpcr, break; default: - subscription_lock(); LIST_FOREACH(s, &t->tht_subscriptions, ths_transport_link) { s->ths_total_err += err; s->ths_callback(s, tsb, pi, pcr); } - subscription_unlock(); break; } }