try to fix shutdown after wakeup, if several recordings was done,

cancel shutdown after wakeup, if remote used, based on code (c) martii <m4rtii@gmx.de>
This commit is contained in:
[CST] Focus
2013-07-30 14:10:21 +04:00
parent 4fa0c9a233
commit d886a95acd
4 changed files with 27 additions and 4 deletions

View File

@@ -727,11 +727,12 @@ bool CTimerManager::shutdown()
void CTimerManager::shutdownOnWakeup(int currEventID)
{
time_t nextAnnounceTime=0;
if(wakeup == 0)
return;
wakeup = 0;
pthread_mutex_lock(&tm_eventsMutex);
if(wakeup == 0) {
pthread_mutex_unlock(&tm_eventsMutex);
return;
}
CTimerEventMap::iterator pos = events.begin();
for(;pos != events.end();++pos)
@@ -756,10 +757,23 @@ void CTimerManager::shutdownOnWakeup(int currEventID)
{ // in den naechsten 10 min steht nix an
dprintf("Programming shutdown event\n");
CTimerEvent_Shutdown* event = new CTimerEvent_Shutdown(now+120, now+180);
addEvent(event);
shutdown_eventID = addEvent(event);
wakeup = 0;
}
pthread_mutex_unlock(&tm_eventsMutex);
}
void CTimerManager::cancelShutdownOnWakeup()
{
pthread_mutex_lock(&tm_eventsMutex);
if (shutdown_eventID > -1) {
removeEvent(shutdown_eventID);
shutdown_eventID = -1;
}
wakeup = 0;
pthread_mutex_unlock(&tm_eventsMutex);
}
void CTimerManager::setRecordingSafety(int pre, int post)
{
m_extraTimeStart=pre;