get rid of the subscription_mutex it's not needed anymore

This commit is contained in:
Andreas Öman 2007-09-29 14:43:00 +00:00
parent 6266b5427f
commit 3cfa916010
4 changed files with 1 additions and 54 deletions

12
dvb.c
View file

@ -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;

View file

@ -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);
}

View file

@ -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);

View file

@ -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;
}
}