Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
change mi_running to atomic ops (clang)
  • Loading branch information
perexg committed Mar 8, 2016
1 parent a944581 commit 29381e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/input/mpegts.h
Expand Up @@ -671,7 +671,7 @@ struct mpegts_input
* Input processing
*/

uint8_t mi_running; /* threads running */
int mi_running; /* threads running */
time_t mi_last_dispatch;

/* Data input */
Expand Down
12 changes: 6 additions & 6 deletions src/input/mpegts/mpegts_input.c
Expand Up @@ -1451,7 +1451,7 @@ mpegts_input_thread ( void * p )

mi->mi_display_name(mi, buf, sizeof(buf));
pthread_mutex_lock(&mi->mi_input_lock);
while (mi->mi_running) {
while (atomic_get(&mi->mi_running)) {

/* Wait for a packet */
if (!(mp = TAILQ_FIRST(&mi->mi_input_queue))) {
Expand Down Expand Up @@ -1517,7 +1517,7 @@ mpegts_input_table_thread ( void *aux )
char muxname[256];

pthread_mutex_lock(&mi->mi_output_lock);
while (mi->mi_running) {
while (atomic_get(&mi->mi_running)) {

/* Wait for data */
if (!(mtf = TAILQ_FIRST(&mi->mi_table_queue))) {
Expand All @@ -1529,7 +1529,7 @@ mpegts_input_table_thread ( void *aux )

/* Process */
pthread_mutex_lock(&global_lock);
if (mi->mi_running) {
if (atomic_get(&mi->mi_running)) {
if (mm != mtf->mtf_mux) {
mm = mtf->mtf_mux;
if (mm)
Expand Down Expand Up @@ -1684,7 +1684,7 @@ static void
mpegts_input_thread_start ( void *aux )
{
mpegts_input_t *mi = aux;
mi->mi_running = 1;
atomic_set(&mi->mi_running, 1);

tvhthread_create(&mi->mi_table_tid, NULL,
mpegts_input_table_thread, mi, "mi-table");
Expand All @@ -1695,7 +1695,7 @@ mpegts_input_thread_start ( void *aux )
static void
mpegts_input_thread_stop ( mpegts_input_t *mi )
{
mi->mi_running = 0;
atomic_set(&mi->mi_running, 0);
mtimer_disarm(&mi->mi_input_thread_start);

/* Stop input thread */
Expand Down Expand Up @@ -1828,7 +1828,7 @@ mpegts_input_delete ( mpegts_input_t *mi, int delconf )
tvh_input_instance_t *tii, *tii_next;

/* Early shutdown flag */
mi->mi_running = 0;
atomic_set(&mi->mi_running, 0);

idnode_save_check(&mi->ti_id, delconf);

Expand Down

0 comments on commit 29381e6

Please sign in to comment.