diff options
author | Jim Carroll <thecarrolls@jiminger.com> | 2011-06-18 19:08:25 -0400 |
---|---|---|
committer | Jim Carroll <thecarrolls@jiminger.com> | 2011-06-23 10:15:27 -0400 |
commit | dc6bfcd44674aa8e98c2506270f875749c374ed3 (patch) | |
tree | 5046bd029f7e71b5d7690d669884b13ae5ee1b64 | |
parent | 194473b9ff5a1fd26ed92c690ee27ab172d63973 (diff) |
Fixed a few issues with Windows. ERROR was #defined so the TimedWaitResponse enum values were renamed. Also a leftover CSingleExit::Restore call was left in code only compiled under windows.
-rw-r--r-- | xbmc/Application.cpp | 12 | ||||
-rw-r--r-- | xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp | 4 | ||||
-rw-r--r-- | xbmc/linux/XSyncUtils.cpp | 12 | ||||
-rw-r--r-- | xbmc/threads/Condition.cpp | 20 | ||||
-rw-r--r-- | xbmc/threads/Condition.h | 2 | ||||
-rw-r--r-- | xbmc/threads/Event.cpp | 2 |
6 files changed, 26 insertions, 26 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 13180be30e..6eb0e92bc9 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -1923,7 +1923,7 @@ bool CApplication::WaitFrame(unsigned int timeout) while(m_frameCount > 0) { ConditionVariable::TimedWaitResponse result = m_frameCond.wait(lock, dwRemainingTime); - if (result == ConditionVariable::OK) + if (result == ConditionVariable::TW_OK) { //fix time to wait because of spurious wakeups DWORD dwElapsed = CTimeUtils::GetTimeMS() - dwStartTime; @@ -1935,11 +1935,11 @@ bool CApplication::WaitFrame(unsigned int timeout) else { //ran out of time - result = ConditionVariable::TIMEDOUT; + result = ConditionVariable::TW_TIMEDOUT; } } - if(result == ConditionVariable::TIMEDOUT) + if(result == ConditionVariable::TW_TIMEDOUT) break; if(result < 0) CLog::Log(LOGWARNING, "CApplication::WaitFrame - error from conditional wait"); @@ -2002,7 +2002,7 @@ void CApplication::Render() while(m_frameCount == 0) { ConditionVariable::TimedWaitResponse result = m_frameCond.wait(lock, dwRemainingTime); - if (result == ConditionVariable::OK) + if (result == ConditionVariable::TW_OK) { //fix time to wait because of spurious wakeups DWORD dwElapsed = CTimeUtils::GetTimeMS() - dwStartTime; @@ -2014,11 +2014,11 @@ void CApplication::Render() else { //ran out of time - result = ConditionVariable::TIMEDOUT; + result = ConditionVariable::TW_TIMEDOUT; } } - if(result == ConditionVariable::TIMEDOUT) + if(result == ConditionVariable::TW_TIMEDOUT) break; if(result < 0) CLog::Log(LOGWARNING, "CApplication::Render - error from conditional wait"); diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp index 276ec59148..003e0c0b82 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/DXVA.cpp @@ -587,9 +587,9 @@ bool CDecoder::OpenProcessor() { m_state = DXVA_OPEN; - { CSingleExit leave(m_section); + { + CSingleExit leave(m_section); CProcessor* processor = new CProcessor(); - leave.Restore(); m_processor = processor; } diff --git a/xbmc/linux/XSyncUtils.cpp b/xbmc/linux/XSyncUtils.cpp index 225b0d7c42..bd171bcc8f 100644 --- a/xbmc/linux/XSyncUtils.cpp +++ b/xbmc/linux/XSyncUtils.cpp @@ -172,7 +172,7 @@ void GlobalMemoryStatus(LPMEMORYSTATUS lpBuffer) static DWORD WINAPI WaitForEvent(HANDLE hHandle, CSingleLock& lock, DWORD dwMilliseconds) { DWORD dwRet = 0; - ConditionVariable::TimedWaitResponse nRet = ConditionVariable::OK; + ConditionVariable::TimedWaitResponse nRet = ConditionVariable::TW_OK; // something like the following would be nice, // but I can't figure a wait to check if a mutex is locked: // assert(hHandle->m_hMutex.IsLocked()); @@ -180,7 +180,7 @@ static DWORD WINAPI WaitForEvent(HANDLE hHandle, CSingleLock& lock, DWORD dwMill { if (dwMilliseconds == 0) { - nRet = ConditionVariable::TIMEDOUT; + nRet = ConditionVariable::TW_TIMEDOUT; } else if (dwMilliseconds == INFINITE) { @@ -188,7 +188,7 @@ static DWORD WINAPI WaitForEvent(HANDLE hHandle, CSingleLock& lock, DWORD dwMill while( hHandle->m_bEventSet == false ) { hHandle->m_hCond->wait(lock); - nRet = ConditionVariable::OK; + nRet = ConditionVariable::TW_OK; } } else @@ -211,7 +211,7 @@ static DWORD WINAPI WaitForEvent(HANDLE hHandle, CSingleLock& lock, DWORD dwMill else { //ran out of time - nRet = ConditionVariable::TIMEDOUT; + nRet = ConditionVariable::TW_TIMEDOUT; break; } } @@ -222,9 +222,9 @@ static DWORD WINAPI WaitForEvent(HANDLE hHandle, CSingleLock& lock, DWORD dwMill hHandle->m_bEventSet = false; // Translate return code. - if (nRet == ConditionVariable::OK) + if (nRet == ConditionVariable::TW_OK) dwRet = WAIT_OBJECT_0; - else if (nRet == ConditionVariable::TIMEDOUT) + else if (nRet == ConditionVariable::TW_TIMEDOUT) dwRet = WAIT_TIMEOUT; else dwRet = WAIT_FAILED; diff --git a/xbmc/threads/Condition.cpp b/xbmc/threads/Condition.cpp index 56bd7c6cdc..d9b813515c 100644 --- a/xbmc/threads/Condition.cpp +++ b/xbmc/threads/Condition.cpp @@ -26,36 +26,36 @@ namespace XbmcThreads ConditionVariable::TimedWaitResponse ConditionVariable::wait(CSingleLock& lock, int milliseconds) { - ConditionVariable::TimedWaitResponse ret = OK; + ConditionVariable::TimedWaitResponse ret = TW_OK; try { - ret = (impl.timed_wait(lock, boost::posix_time::milliseconds(milliseconds))) ? OK : TIMEDOUT; + ret = (impl.timed_wait(lock, boost::posix_time::milliseconds(milliseconds))) ? TW_OK : TW_TIMEDOUT; } - catch (boost::thread_interrupted exception) + catch (boost::thread_interrupted ) { - ret = INTERRUPTED; + ret = TW_INTERRUPTED; } catch (...) { - ret = ERROR; + ret = TW_ERROR; } return ret; } ConditionVariable::TimedWaitResponse ConditionVariable::wait(CCriticalSection& mutex, int milliseconds) { - ConditionVariable::TimedWaitResponse ret = OK; + ConditionVariable::TimedWaitResponse ret = TW_OK; try { - ret = (impl.timed_wait(mutex, boost::posix_time::milliseconds(milliseconds))) ? OK : TIMEDOUT; + ret = (impl.timed_wait(mutex, boost::posix_time::milliseconds(milliseconds))) ? TW_OK : TW_TIMEDOUT; } - catch (boost::thread_interrupted exception) + catch (boost::thread_interrupted ) { - ret = INTERRUPTED; + ret = TW_INTERRUPTED; } catch (...) { - ret = ERROR; + ret = TW_ERROR; } return ret; } diff --git a/xbmc/threads/Condition.h b/xbmc/threads/Condition.h index c0e54036d1..a0dea3f377 100644 --- a/xbmc/threads/Condition.h +++ b/xbmc/threads/Condition.h @@ -43,7 +43,7 @@ namespace XbmcThreads public: inline ConditionVariable() {} - enum TimedWaitResponse { OK = 0, TIMEDOUT = 1, INTERRUPTED=-1, ERROR=-2 }; + enum TimedWaitResponse { TW_OK = 0, TW_TIMEDOUT = 1, TW_INTERRUPTED=-1, TW_ERROR=-2 }; inline void wait(CSingleLock& lock) { impl.wait(lock); } inline void wait(CCriticalSection& mutex) { impl.wait(mutex); } diff --git a/xbmc/threads/Event.cpp b/xbmc/threads/Event.cpp index 6b9b3ec777..ff3133df7c 100644 --- a/xbmc/threads/Event.cpp +++ b/xbmc/threads/Event.cpp @@ -64,7 +64,7 @@ bool CEvent::WaitMSec(unsigned int milliSeconds) if (setState) return true; - if (resp == XbmcThreads::ConditionVariable::TIMEDOUT) + if (resp == XbmcThreads::ConditionVariable::TW_TIMEDOUT) return false; unsigned int elapsedTimeMillis = CTimeUtils::GetTimeMS() - startTime; |