[vlc-devel] [PATCH 1/2] win32:thread: SleepEx and WaitForMultipleObjectsEx have a millisecond precision

Steve Lhomme robux4 at videolabs.io
Thu May 26 13:02:25 CEST 2016


---
 src/win32/thread.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index ea8ffe3..3e942c4 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -268,14 +268,14 @@ void vlc_cond_broadcast(vlc_cond_t *wait)
 }
 
 static int vlc_cond_wait_delay(vlc_cond_t *wait, vlc_mutex_t *lock,
-                               mtime_t us)
+                               mtime_t ms)
 {
-    if (us < 0)
-        us = 0;
-    if (us > 0x7fffffff)
-        us = 0x7fffffff;
+    if (ms < 0)
+        ms = 0;
+    if (ms > 0x7fffffff)
+        ms = 0x7fffffff;
 
-    DWORD delay = us;
+    DWORD delay = ms;
     DWORD result;
 
     vlc_testcancel();
@@ -305,7 +305,7 @@ void vlc_cond_wait(vlc_cond_t *wait, vlc_mutex_t *lock)
 
 int vlc_cond_timedwait(vlc_cond_t *wait, vlc_mutex_t *lock, mtime_t deadline)
 {
-    return vlc_cond_wait_delay(wait, lock, deadline - mdate());
+    return vlc_cond_wait_delay(wait, lock, (deadline - mdate()) / 1000);
 }
 
 int vlc_cond_timedwait_daytime(vlc_cond_t *wait, vlc_mutex_t *lock,
@@ -315,7 +315,7 @@ int vlc_cond_timedwait_daytime(vlc_cond_t *wait, vlc_mutex_t *lock,
     mtime_t delay;
 
     time(&now);
-    delay = ((mtime_t)deadline - (mtime_t)now) * CLOCK_FREQ;
+    delay = ((mtime_t)deadline - (mtime_t)now) * 1000;
 
     return vlc_cond_wait_delay(wait, lock, delay);
 }
-- 
2.8.1



More information about the vlc-devel mailing list