summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Lampard <mlampard@users.sourceforge.net>2004-10-30 04:06:48 +0000
committerMike Lampard <mlampard@users.sourceforge.net>2004-10-30 04:06:48 +0000
commit5468d24b087638db637487e08fded11460175d06 (patch)
tree2ed12c338bfc47eff71401d27b518c4c9ce94288
parent9320048966af54c31a0cc84f956460167c9bf882 (diff)
downloadxine-lib-5468d24b087638db637487e08fded11460175d06.tar.gz
xine-lib-5468d24b087638db637487e08fded11460175d06.tar.bz2
check to ensure we have the mutex before unlocking it.
CVS patchset: 7088 CVS date: 2004/10/30 04:06:48
-rw-r--r--src/input/input_dvb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/input/input_dvb.c b/src/input/input_dvb.c
index 184340b32..27b95556b 100644
--- a/src/input/input_dvb.c
+++ b/src/input/input_dvb.c
@@ -1632,6 +1632,7 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen,
char *buf, off_t len) {
dvb_input_plugin_t *this = (dvb_input_plugin_t *) this_gen;
off_t n=0, total=0;
+ int have_mutex=0;
struct pollfd pfd;
dvb_event_handler (this);
@@ -1639,7 +1640,7 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen,
nbc_check_buffers (this->nbc);
- pthread_mutex_trylock( &this->mutex ); /* protect agains channel changes */
+ have_mutex=pthread_mutex_trylock( &this->mutex ); /* protect agains channel changes */
total=0;
pfd.fd=this->fd;
pfd.events = POLLPRI | POLLIN;
@@ -1676,8 +1677,8 @@ static off_t dvb_plugin_read (input_plugin_t *this_gen,
if ((this->record_fd)&&(!this->record_paused))
write (this->record_fd, buf, total);
-
- pthread_mutex_unlock( &this->mutex );
+ if(have_mutex==0)
+ pthread_mutex_unlock( &this->mutex );
/* no data for 10 seconds - tell the user a possible reason */
if(this->read_failcount==5){
_x_message(this->stream,1,"DVB Signal Lost. Please check connections.");