diff options
author | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2008-08-24 14:00:28 +0200 |
---|---|---|
committer | Christian Wieninger <cwieninger (at) gmx (dot) de> | 2008-08-24 14:00:28 +0200 |
commit | 36a1702cb9b22a91dec25844bbb9674cc7e01087 (patch) | |
tree | 3a2a32e43c807ef893a2741ffeab3da5401a97a8 /switchtimer_thread.c | |
parent | c710608b32f65500d70620275db178834bec1a1f (diff) | |
download | vdr-plugin-epgsearch-36a1702cb9b22a91dec25844bbb9674cc7e01087.tar.gz vdr-plugin-epgsearch-36a1702cb9b22a91dec25844bbb9674cc7e01087.tar.bz2 |
moved from cCondWait::SleepMs to cCondWait::Wait to avoid shutdown problems, patch by
e9hack
Diffstat (limited to 'switchtimer_thread.c')
-rw-r--r-- | switchtimer_thread.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/switchtimer_thread.c b/switchtimer_thread.c index d1bf9ec..7f6388f 100644 --- a/switchtimer_thread.c +++ b/switchtimer_thread.c @@ -60,6 +60,7 @@ void cSwitchTimerThread::Exit(void) { void cSwitchTimerThread::Stop(void) { m_Active = false; + Wait.Signal(); Cancel(6); } @@ -69,7 +70,7 @@ void cSwitchTimerThread::Action(void) // let VDR do its startup for(int wait = 0; wait < SWITCHTIMER_WAIT && m_Active; wait++) - sleepSec(1); + Wait.Wait(1000); time_t nextUpdate = time(NULL); while (m_Active) @@ -104,7 +105,8 @@ void cSwitchTimerThread::Action(void) cString Message = cString::sprintf("%s: %s - %s", event->Title(), CHANNELNAME(channel), GETTIMESTRING(event)); SendMsg(Message); - sleepSec(MSG_DELAY); + if (m_Active) + Wait.Wait(1000 * MSG_DELAY); } SwitchTimers.Save(); break; @@ -112,15 +114,16 @@ void cSwitchTimerThread::Action(void) switchTimer = SwitchTimers.Next(switchTimer); } LogFile.Log(3,"switch timer check finished"); - sleepSec(MSG_DELAY); + if (m_Active) + Wait.Wait(1000 * MSG_DELAY); m_lastUpdate = time(NULL); nextUpdate = long(m_lastUpdate/60)*60+ 60 - MSG_DELAY ; // check at each full minute minus 5sec if (SwitchTimers.Count() == 0) m_Active = false; } while (m_Active && time(NULL)%MSG_DELAY != 0) // sync heart beat to MSG_DELAY - sleepSec(1); - sleepSec(1); + Wait.Wait(1000); + Wait.Wait(1000); }; m_Instance = NULL; } |