From 9f5397b51006f7918c07217b98e91ced547eb6f6 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 2 Mar 2002 09:37:56 +0100 Subject: [PATCH] Fixed a deadlock when switching channels via Schedule/Now|Next/Switch --- CONTRIBUTORS | 1 + HISTORY | 6 ++++++ config.h | 4 ++-- dvbapi.c | 5 +---- eit.c | 22 +++++----------------- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 1acaafcb..ed63a4bb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -39,6 +39,7 @@ Martin Hammerschmid for suggesting to display the direct channel select input on the OSD for suggesting to use the "Blue" button in the main menu to resume replay for implementing pege up/down with the "Left" and "Right" keys + for detecting a deadlock when switching channels via Schedule/Now|Next/Switch Bastian Guse for writing the FORMATS entry for timers.conf diff --git a/HISTORY b/HISTORY index 2b0093e0..836de4c5 100644 --- a/HISTORY +++ b/HISTORY @@ -1047,3 +1047,9 @@ Video Disk Recorder Revision History - Fixed a crash in case there is no 'epg.data' at program start (thanks to Andreas Schultz). + +2002-03-01: Version 1.0.0pre3 + +- Fixed parsing 'E' records in epg2html.pl. +- Fixed a deadlock when switching channels via Schedule/Now|Next/Switch (reported + by Martin Hammerschmid). diff --git a/config.h b/config.h index b5860d18..52a203ff 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 1.100 2002/02/25 16:29:09 kls Exp $ + * $Id: config.h 1.101 2002/02/26 17:25:30 kls Exp $ */ #ifndef __CONFIG_H @@ -19,7 +19,7 @@ #include "eit.h" #include "tools.h" -#define VDRVERSION "1.0.0pre2" +#define VDRVERSION "1.0.0pre3" #define MAXPRIORITY 99 #define MAXLIFETIME 99 diff --git a/dvbapi.c b/dvbapi.c index 55bc5731..c55142e1 100644 --- a/dvbapi.c +++ b/dvbapi.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbapi.c 1.152 2002/02/24 12:53:51 kls Exp $ + * $Id: dvbapi.c 1.153 2002/03/02 09:37:56 kls Exp $ */ #include "dvbapi.h" @@ -2238,9 +2238,6 @@ bool cDvbApi::SetPids(bool ForRecording) eSetChannelResult cDvbApi::SetChannel(int ChannelNumber, int Frequency, char Polarization, int Diseqc, int Srate, int Vpid, int Apid1, int Apid2, int Dpid1, int Dpid2, int Tpid, int Ca, int Pnr) { - // Make sure the siProcessor won't access the device while switching - cThreadLock ThreadLock(siProcessor); - StopTransfer(); StopReplay(); diff --git a/eit.c b/eit.c index 8f4c0372..9985fbbd 100644 --- a/eit.c +++ b/eit.c @@ -16,7 +16,7 @@ * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * - * $Id: eit.c 1.38 2002/02/25 16:30:42 kls Exp $ + * $Id: eit.c 1.39 2002/03/01 16:32:11 kls Exp $ ***************************************************************************/ #include "eit.h" @@ -1047,8 +1047,6 @@ const char *cSIProcessor::GetEpgDataFileName(void) void cSIProcessor::SetStatus(bool On) { - LOCK_THREAD; - schedulesMutex.Lock(); ShutDownFilters(); if (On) { @@ -1061,7 +1059,6 @@ void cSIProcessor::SetStatus(bool On) AddFilter(0x12, 0x51); // event info, actual TS, schedule for another 4 days AddFilter(0x12, 0x61); // event info, other TS, schedule for another 4 days } - schedulesMutex.Unlock(); } /** use the vbi device to parse all relevant SI @@ -1085,20 +1082,15 @@ void cSIProcessor::Action() struct tm *ptm = localtime_r(&now, &tm_r); if (now - lastCleanup > 3600 && ptm->tm_hour == 5) { - LOCK_THREAD; - - schedulesMutex.Lock(); + cMutexLock MutexLock(&schedulesMutex); isyslog(LOG_INFO, "cleaning up schedules data"); schedules->Cleanup(); - schedulesMutex.Unlock(); lastCleanup = now; ReportEpgBugFixStats(true); } if (epgDataFileName && now - lastDump > 600) { - LOCK_THREAD; - - schedulesMutex.Lock(); + cMutexLock MutexLock(&schedulesMutex); FILE *f = fopen(GetEpgDataFileName(), "w"); if (f) { schedules->Dump(f); @@ -1107,7 +1099,6 @@ void cSIProcessor::Action() else LOG_ERROR; lastDump = now; - schedulesMutex.Unlock(); } } @@ -1162,12 +1153,9 @@ void cSIProcessor::Action() case 0x12: if (buf[0] != 0x72) { - LOCK_THREAD; - - schedulesMutex.Lock(); + cMutexLock MutexLock(&schedulesMutex); cEIT ceit(buf, seclen, schedules); ceit.ProcessEIT(buf); - schedulesMutex.Unlock(); } else dsyslog(LOG_INFO, "Received stuffing section in EIT\n"); @@ -1261,6 +1249,6 @@ bool cSIProcessor::ShutDownFilters(void) /** */ bool cSIProcessor::SetCurrentServiceID(unsigned short servid) { - LOCK_THREAD; + cMutexLock MutexLock(&schedulesMutex); return schedules ? schedules->SetCurrentServiceID(servid) : false; }