diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2021-01-14 10:29:05 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2021-01-14 10:29:05 +0100 |
commit | 80bdc9065093caca1c1da7373dd25a6b52bb5774 (patch) | |
tree | 3458586adb90f0236e085fd8acdd5552619d4f04 /timers.c | |
parent | c402d57809e42137b4294185ed0b27af312f7471 (diff) | |
download | vdr-80bdc9065093caca1c1da7373dd25a6b52bb5774.tar.gz vdr-80bdc9065093caca1c1da7373dd25a6b52bb5774.tar.bz2 |
Now explicitly triggering respawning of pattern timers
Diffstat (limited to 'timers.c')
-rw-r--r-- | timers.c | 19 |
1 files changed, 17 insertions, 2 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: timers.c 5.2 2021/01/07 16:00:17 kls Exp $ + * $Id: timers.c 5.3 2021/01/14 10:29:05 kls Exp $ */ #include "timers.h" @@ -739,6 +739,20 @@ bool cTimer::SpawnPatternTimers(const cSchedules *Schedules, cTimers *Timers) return TimersSpawned; } +void cTimer::TriggerRespawn(void) +{ + if (HasFlags(tfSpawned) || IsPatternTimer()) { + if (Channel()) { + LOCK_CHANNELS_READ; + if (const cSchedule *Schedule = Channel()->Schedule()) { + dsyslog("triggering respawn for timer %s", *ToDescr()); + LOCK_SCHEDULES_WRITE; + const_cast<cSchedule *>(Schedule)->SetModified(); + } + } + } +} + bool cTimer::SetEventFromSchedule(const cSchedules *Schedules) { if (IsPatternTimer()) @@ -918,7 +932,7 @@ void cTimer::OnOff(void) SetFlags(tfActive); SetEvent(NULL); if (HasFlags(tfActive)) - scheduleState = -1; // have pattern timers spawn if necessary + TriggerRespawn(); // have pattern timers spawn if necessary Matches(); // refresh start and end time } @@ -1112,6 +1126,7 @@ bool cTimers::DeleteExpired(void) cTimer *next = Next(ti); if (!ti->Remote() && ti->Expired()) { ti->SetEvent(NULL); // Del() doesn't call ~cTimer() right away, so this is necessary here + ti->TriggerRespawn(); // in case this is a spawned timer isyslog("deleting timer %s", *ti->ToDescr()); Del(ti); TimersModified = true; |