diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2015-09-01 11:14:27 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2015-09-01 11:14:27 +0200 |
commit | 3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d (patch) | |
tree | da57ce74189de9bfb27e1a747063c37cd62de501 /eitscan.c | |
parent | 8a7bc6a0bbf60cae8b6391a630880aad5cba3363 (diff) | |
download | vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.gz vdr-3cd5294d8a337ee5cd2ec894c9fbe04ad3a7690d.tar.bz2 |
Implemented strict locking of global lists
Diffstat (limited to 'eitscan.c')
-rw-r--r-- | eitscan.c | 18 |
1 files changed, 10 insertions, 8 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: eitscan.c 2.7 2012/04/07 14:39:28 kls Exp $ + * $Id: eitscan.c 4.1 2015/07/18 10:16:51 kls Exp $ */ #include "eitscan.h" @@ -45,13 +45,13 @@ int cScanData::Compare(const cListObject &ListObject) const class cScanList : public cList<cScanData> { public: - void AddTransponders(cList<cChannel> *Channels); + void AddTransponders(const cList<cChannel> *Channels); void AddTransponder(const cChannel *Channel); }; -void cScanList::AddTransponders(cList<cChannel> *Channels) +void cScanList::AddTransponders(const cList<cChannel> *Channels) { - for (cChannel *ch = Channels->First(); ch; ch = Channels->Next(ch)) + for (const cChannel *ch = Channels->First(); ch; ch = Channels->Next(ch)) AddTransponder(ch); Sort(); } @@ -118,7 +118,8 @@ void cEITScanner::ForceScan(void) void cEITScanner::Activity(void) { if (currentChannel) { - Channels.SwitchTo(currentChannel); + LOCK_CHANNELS_READ; + Channels->SwitchTo(currentChannel); currentChannel = 0; } lastActivity = time(NULL); @@ -129,7 +130,8 @@ void cEITScanner::Process(void) if (Setup.EPGScanTimeout || !lastActivity) { // !lastActivity means a scan was forced time_t now = time(NULL); if (now - lastScan > ScanTimeout && now - lastActivity > ActivityTimeout) { - if (Channels.Lock(false, 10)) { + cStateKey StateKey; + if (const cChannels *Channels = cChannels::GetChannelsRead(StateKey, 10)) { if (!scanList) { scanList = new cScanList; if (transponderList) { @@ -137,7 +139,7 @@ void cEITScanner::Process(void) delete transponderList; transponderList = NULL; } - scanList->AddTransponders(&Channels); + scanList->AddTransponders(Channels); } bool AnyDeviceSwitched = false; for (int i = 0; i < cDevice::NumDevices(); i++) { @@ -177,7 +179,7 @@ void cEITScanner::Process(void) if (lastActivity == 0) // this was a triggered scan Activity(); } - Channels.Unlock(); + StateKey.Remove(); } lastScan = time(NULL); } |