Commit 1a8e62c8 authored by Jean-Paul Saman's avatar Jean-Paul Saman

dvbinfo: protect buffer depth count with mutex.

parent 93012b7d
...@@ -137,6 +137,7 @@ void fifo_push(fifo_t *fifo, buffer_t *buffer) ...@@ -137,6 +137,7 @@ void fifo_push(fifo_t *fifo, buffer_t *buffer)
if (buffer == NULL) if (buffer == NULL)
return; return;
pthread_mutex_lock(&fifo->lock);
for (p_last = buffer; ; p_last = p_last->p_next) for (p_last = buffer; ; p_last = p_last->p_next)
{ {
i_depth ++; i_depth ++;
...@@ -144,7 +145,6 @@ void fifo_push(fifo_t *fifo, buffer_t *buffer) ...@@ -144,7 +145,6 @@ void fifo_push(fifo_t *fifo, buffer_t *buffer)
break; break;
} }
pthread_mutex_lock(&fifo->lock);
*fifo->pp_last = buffer; *fifo->pp_last = buffer;
fifo->pp_last = &p_last->p_next; fifo->pp_last = &p_last->p_next;
fifo->i_count += i_depth; fifo->i_count += i_depth;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment