Fixed the locking sequence when dumping EPG data

This commit is contained in:
Klaus Schmidinger 2017-05-28 13:08:09 +02:00
parent 0af3ed548c
commit 2751e239eb
4 changed files with 10 additions and 9 deletions

View File

@ -9063,3 +9063,4 @@ Video Disk Recorder Revision History
macro DEBUG_LOCKSEQ in thread.c. At the first occurrence of an invalid locking
sequence, the 20 most recent locks will be printed to stderr, followed by a
backtrace that led to the call in question.
- Fixed the locking sequence when dumping EPG data.

8
epg.c
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.c 4.7 2017/05/28 11:30:32 kls Exp $
* $Id: epg.c 4.8 2017/05/28 13:08:09 kls Exp $
*/
#include "epg.h"
@ -1104,9 +1104,8 @@ void cSchedule::Cleanup(time_t Time)
}
}
void cSchedule::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtTime) const
void cSchedule::Dump(const cChannels *Channels, FILE *f, const char *Prefix, eDumpMode DumpMode, time_t AtTime) const
{
LOCK_CHANNELS_READ;
if (const cChannel *Channel = Channels->GetByChannelID(channelID, true)) {
fprintf(f, "%sC %s %s\n", Prefix, *Channel->GetChannelID().ToString(), Channel->Name());
const cEvent *p;
@ -1280,9 +1279,10 @@ bool cSchedules::Dump(FILE *f, const char *Prefix, eDumpMode DumpMode, time_t At
return false;
}
}
LOCK_CHANNELS_READ;
LOCK_SCHEDULES_READ;
for (const cSchedule *p = Schedules->First(); p; p = Schedules->Next(p))
p->Dump(f, Prefix, DumpMode, AtTime);
p->Dump(Channels, f, Prefix, DumpMode, AtTime);
if (sf) {
sf->Close();
delete sf;

4
epg.h
View File

@ -7,7 +7,7 @@
* Original version (as used in VDR before 1.3.0) written by
* Robert Schneider <Robert.Schneider@web.de> and Rolf Hakenes <hakenes@hippomi.de>.
*
* $Id: epg.h 4.6 2017/05/09 12:15:14 kls Exp $
* $Id: epg.h 4.7 2017/05/28 12:59:20 kls Exp $
*/
#ifndef __EPG_H
@ -185,7 +185,7 @@ public:
const cEvent *GetFollowingEvent(void) const;
const cEvent *GetEvent(tEventID EventID, time_t StartTime = 0) const;
const cEvent *GetEventAround(time_t Time) const;
void Dump(FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const;
void Dump(const cChannels *Channels, FILE *f, const char *Prefix = "", eDumpMode DumpMode = dmAll, time_t AtTime = 0) const;
static bool Read(FILE *f, cSchedules *Schedules);
};

View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
* $Id: svdrp.c 4.18 2017/05/18 15:51:24 kls Exp $
* $Id: svdrp.c 4.19 2017/05/28 13:05:23 kls Exp $
*/
#include "svdrp.h"
@ -1615,6 +1615,7 @@ void cSVDRPServer::CmdLSTC(const char *Option)
void cSVDRPServer::CmdLSTE(const char *Option)
{
LOCK_CHANNELS_READ;
LOCK_SCHEDULES_READ;
const cSchedule* Schedule = NULL;
eDumpMode DumpMode = dmAll;
@ -1646,7 +1647,6 @@ void cSVDRPServer::CmdLSTE(const char *Option)
}
}
else if (!Schedule) {
LOCK_CHANNELS_READ;
const cChannel* Channel = NULL;
if (isnumber(p))
Channel = Channels->GetByNumber(strtol(Option, NULL, 10));
@ -1676,7 +1676,7 @@ void cSVDRPServer::CmdLSTE(const char *Option)
FILE *f = fdopen(fd, "w");
if (f) {
if (Schedule)
Schedule->Dump(f, "215-", DumpMode, AtTime);
Schedule->Dump(Channels, f, "215-", DumpMode, AtTime);
else
Schedules->Dump(f, "215-", DumpMode, AtTime);
fflush(f);