]> git.sesse.net Git - vlc/commitdiff
Fixed vlc_cond_timedwait for win32.
authorLaurent Aimar <fenrir@videolan.org>
Sun, 7 Sep 2008 15:17:06 +0000 (17:17 +0200)
committerLaurent Aimar <fenrir@videolan.org>
Sun, 7 Sep 2008 15:17:06 +0000 (17:17 +0200)
Windows API expect a timeout in millisecond.
SignaObjectAndWait should properly work with a 0 timeout, so try it.
(avoid an invalid lock and an uninitialized return value).

include/vlc_threads.h

index 7a265b0d4bda752abd407395e22718ac21f63b96..c61f6a91c9c317b6a2ee55b97f0a71e77373afab 100644 (file)
@@ -447,9 +447,10 @@ static inline int __vlc_cond_timedwait( const char * psz_file, int i_line,
     {
         vlc_testcancel ();
 
-        mtime_t total = deadline - mdate ();
-        if (total <= 0)
-            break;
+        mtime_t total = (deadline - mdate ())/1000;
+        if( total < 0 )
+            total = 0;
+
         DWORD delay = (total > 0x7fffffff) ? 0x7fffffff : total;
         result = SignalObjectAndWait (*p_mutex, *p_condvar, delay, TRUE);
     }