diff options
author | Jasmin Jessich <jasmin@anw.at> | 2017-05-18 23:11:34 +0200 |
---|---|---|
committer | Jasmin Jessich <jasmin@anw.at> | 2017-05-18 23:11:34 +0200 |
commit | be4f333e60a6d992e11610d9918ca745db23902b (patch) | |
tree | 3524ae9ed326481e6a9e9ba0fd228d9e53def0a7 | |
parent | 8c21f7d47998ffc1c2c6568226eb693b0a918c7a (diff) | |
download | vdr-plugin-live-be4f333e60a6d992e11610d9918ca745db23902b.tar.gz vdr-plugin-live-be4f333e60a6d992e11610d9918ca745db23902b.tar.bz2 |
Fixed lock order in whats_on.ecpp
- whats_on.ecpp will now lock first Channels and then Schedules.
The locking time of Schedules is now much shorter, too.
-rw-r--r-- | pages/whats_on.ecpp | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/pages/whats_on.ecpp b/pages/whats_on.ecpp index 36a8f96..444b845 100644 --- a/pages/whats_on.ecpp +++ b/pages/whats_on.ecpp @@ -38,14 +38,6 @@ string current_displaytime; if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html"); -#if VDRVERSNUM >= 20301 -/* JJJ: Lock this later and in the right order */ -LOCK_SCHEDULES_READ; -#else -cSchedulesLock schedulesLock; -const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); -#endif - string head; time_t seektime = 0; string displaytime; @@ -130,13 +122,12 @@ if (type == "now") { if (type != "favs") { #if VDRVERSNUM >= 20301 - LOCK_CHANNELS_READ; - if (true) { + LOCK_CHANNELS_READ; + { #else ReadLock channelsLock( Channels ); if (channelsLock) { #endif - // int evntNr = 0; #if VDRVERSNUM >= 20301 for (cChannel *Channel = (cChannel *)Channels->First(); Channel && Channel->Number() <= LiveSetup().GetLastChannel(); Channel = (cChannel *)Channels->Next(Channel)) { #else @@ -145,7 +136,18 @@ if (type == "now") { if (Channel->GroupSep()) { continue; } - const cSchedule *Schedule = Schedules->GetSchedule(Channel); + const cSchedule *Schedule; + { +#if VDRVERSNUM >= 20301 + + LOCK_SCHEDULES_READ; +#else + cSchedulesLock schedulesLock; + const cSchedules* Schedules = cSchedules::Schedules(schedulesLock); +#endif + + Schedule = Schedules->GetSchedule(Channel); + } if (!Schedule) { continue; } |