win32: fix < vista compilation
authorLars Op den Kamp <lars@opdenkamp.eu>
Thu, 2 Feb 2012 00:22:51 +0000 (01:22 +0100)
committerLars Op den Kamp <lars@opdenkamp.eu>
Thu, 2 Feb 2012 00:22:51 +0000 (01:22 +0100)
src/lib/platform/windows/os-threads.h

index 88d0c1ee2269e484c2c27d6f3d36029a9e59d010..df1af39e5f0c82e6daa918eb8b99fefafd515853 100644 (file)
@@ -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
 }