From: Lars Op den Kamp Date: Thu, 2 Feb 2012 00:22:51 +0000 (+0100) Subject: win32: fix < vista compilation X-Git-Tag: upstream/2.2.0~1^2~36^2~23 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6a3e78564b615c0fcb71887f93df79bf5d83a741;p=deb_libcec.git win32: fix < vista compilation --- diff --git a/src/lib/platform/windows/os-threads.h b/src/lib/platform/windows/os-threads.h index 88d0c1e..df1af39 100644 --- a/src/lib/platform/windows/os-threads.h +++ b/src/lib/platform/windows/os-threads.h @@ -57,9 +57,13 @@ namespace PLATFORM #define ConditionDelete(cond) ::CloseHandle(cond) #define ConditionSignal(cond) ::SetEvent(cond) #define ConditionBroadcast(cond) ::SetEvent(cond) - #define ConditionWait(cond, mutex, timeout) ::ResetEvent(cond); \ - MutexUnlock(mutex); \ - ::WaitForSingleObject(cond, timeout <= 0 ? 1000 : timeout); \ - MutexLock(mutex) + inline bool ConditionWait(condition_t cond, mutex_t mutex, uint32_t iTimeoutMsg) + { + ::ResetEvent(cond); + MutexUnlock(mutex); + DWORD iWaitReturn = ::WaitForSingleObject(cond, iTimeoutMsg <= 0 ? 1000 : iTimeoutMsg); + MutexLock(mutex); + return iWaitReturn == 0; + } #endif }