From 2685239d3331e50ceebeaf03814aff883c2fa15d Mon Sep 17 00:00:00 2001 From: horchi Date: Fri, 9 Jun 2017 17:48:33 +0200 Subject: 2017-06-09: version 1.1.65 (horchi)\n - Bugfix: Fixed another lock sequence\n\n --- HISTORY.h | 5 ++++- timer.c | 52 +++++++++++++++++++--------------------------------- 2 files changed, 23 insertions(+), 34 deletions(-) diff --git a/HISTORY.h b/HISTORY.h index 85385e7..831fc8f 100644 --- a/HISTORY.h +++ b/HISTORY.h @@ -5,7 +5,7 @@ * */ -#define _VERSION "1.1.64" +#define _VERSION "1.1.65" #define VERSION_DATE "09.06.2017" #define DB_API 4 @@ -19,6 +19,9 @@ /* * ------------------------------------ +2017-06-09: version 1.1.65 (horchi) + - Bugfix: Fixed another lock sequence + 2017-06-09: version 1.1.64 (horchi) - Bugfix: Fixed lock sequence diff --git a/timer.c b/timer.c index 931553d..78d848f 100644 --- a/timer.c +++ b/timer.c @@ -75,6 +75,15 @@ int cUpdate::performTimerJobs() cTimers* timers = &Timers; #endif + // get channels lock + +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + cChannelsLock channelsLock(false); + const cChannels* channels = channelsLock.Channels(); +#else + cChannels* channels = &Channels; +#endif + // get schedules lock #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) @@ -185,12 +194,6 @@ int cUpdate::performTimerJobs() if (!(s = (cSchedule*)schedules->GetSchedule(channelId))) { -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - cChannelsLock channelsLock(false); - const cChannels* channels = channelsLock.Channels(); -#else - cChannels* channels = &Channels; -#endif const cChannel* channel = channels->GetByChannelID(channelId); tell(0, "Error: Time (%d), missing channel '%s' (%s) or channel not found, ignoring request", @@ -214,25 +217,17 @@ int cUpdate::performTimerJobs() if (eventid > 0 && !(event = s->GetEvent(eventid))) { - { -#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - cChannelsLock channelsLock(false); - const cChannels* channels = channelsLock.Channels(); -#else - cChannels* channels = &Channels; -#endif - const cChannel* channel = channels->GetByChannelID(channelId); + const cChannel* channel = channels->GetByChannelID(channelId); - tell(0, "Error: Timer (%d), missing event '%ld' on channel '%s' (%s), ignoring request", - timerid, eventid, channel->Name(), timerDb->getStrValue("CHANNELID")); + tell(0, "Error: Timer (%d), missing event '%ld' on channel '%s' (%s), ignoring request", + timerid, eventid, channel->Name(), timerDb->getStrValue("CHANNELID")); - timerDb->getValue("INFO")->sPrintf("Error: Timer (%d), missing event '%ld' on channel '%s' (%s), ignoring request", - timerid, eventid, channel->Name(), timerDb->getStrValue("CHANNELID")); - timerDb->setCharValue("ACTION", taFailed); - timerDb->setCharValue("STATE", tsError); - timerDb->update(); - updateTimerDone(timerid, doneid, tdsTimerCreateFailed); - } + timerDb->getValue("INFO")->sPrintf("Error: Timer (%d), missing event '%ld' on channel '%s' (%s), ignoring request", + timerid, eventid, channel->Name(), timerDb->getStrValue("CHANNELID")); + timerDb->setCharValue("ACTION", taFailed); + timerDb->setCharValue("STATE", tsError); + timerDb->update(); + updateTimerDone(timerid, doneid, tdsTimerCreateFailed); // force reload of events @@ -271,17 +266,8 @@ int cUpdate::performTimerJobs() } else { -#if APIVERSNUM >= 20301 - LOCK_CHANNELS_READ; - const cChannels* channels = Channels; const cChannel* channel = channels->GetByChannelID(channelId); -#else - cChannels* channels = &Channels; - cChannel* channel = channels->GetByChannelID(channelId); -#endif - // timer without a event - - timer = new cTimer(no, no, channel); + timer = new cTimer(no, no, channel); // timer without a event } // reset error message in 'reason' -- cgit v1.2.3