diff options
-rw-r--r-- | guilib/GraphicContext.cpp | 2 | ||||
-rw-r--r-- | xbmc/ApplicationMessenger.cpp | 12 | ||||
-rw-r--r-- | xbmc/ApplicationMessenger.h | 6 |
3 files changed, 9 insertions, 11 deletions
diff --git a/guilib/GraphicContext.cpp b/guilib/GraphicContext.cpp index 1989531b7e..a4da3e5777 100644 --- a/guilib/GraphicContext.cpp +++ b/guilib/GraphicContext.cpp @@ -327,7 +327,7 @@ void CGraphicContext::SetVideoResolution(RESOLUTION res, bool forceUpdate) g_application.m_pPlayer->Pause(); ThreadMessage msg = {TMSG_MEDIA_PAUSE}; CDelayedMessage* pauseMessage = new CDelayedMessage(msg, delay * 500); - CJobManager::GetInstance().AddJob(pauseMessage, NULL); + pauseMessage->Create(true); } if (res >= RES_DESKTOP) diff --git a/xbmc/ApplicationMessenger.cpp b/xbmc/ApplicationMessenger.cpp index 78afbea26f..d70cb7695b 100644 --- a/xbmc/ApplicationMessenger.cpp +++ b/xbmc/ApplicationMessenger.cpp @@ -79,12 +79,12 @@ CDelayedMessage::CDelayedMessage(ThreadMessage& msg, unsigned int delay) m_delay = delay; } -bool CDelayedMessage::DoWork() +void CDelayedMessage::Process() { CStopWatch stopwatch; stopwatch.Start(); - while(1) + while(!m_bStop && !g_application.m_bStop) { float elapsed = stopwatch.GetElapsedMilliseconds(); @@ -96,15 +96,13 @@ bool CDelayedMessage::DoWork() else sleeptime = (float)m_delay - elapsed; - if (g_application.m_bStop) - return false; - Sleep(sleeptime); } - g_application.getApplicationMessenger().SendMessage(m_msg, false); + if (m_bStop || g_application.m_bStop) + return; - return true; + g_application.getApplicationMessenger().SendMessage(m_msg, false); } CApplicationMessenger::~CApplicationMessenger() diff --git a/xbmc/ApplicationMessenger.h b/xbmc/ApplicationMessenger.h index ed0917dd67..b143653a94 100644 --- a/xbmc/ApplicationMessenger.h +++ b/xbmc/ApplicationMessenger.h @@ -24,7 +24,7 @@ #include "utils/CriticalSection.h" #include "StdString.h" #include "Key.h" -#include "utils/Job.h" +#include "utils/Thread.h" #include <queue> @@ -97,11 +97,11 @@ typedef struct } ThreadMessage; -class CDelayedMessage : public CJob +class CDelayedMessage : public CThread { public: CDelayedMessage(ThreadMessage& msg, unsigned int delay); - virtual bool DoWork(); + virtual void Process(); private: unsigned int m_delay; |