[vlc-commits] win32:thread: SleepEx and WaitForMultipleObjectsEx have a millisecond precision

Steve Lhomme git at videolan.org
Thu May 26 13:44:17 CEST 2016


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu May 26 13:02:25 2016 +0200| [5d0301b9e240b6efa089635629135dcb69ee9383] | committer: Hugo Beauzée-Luyssen

win32:thread: SleepEx and WaitForMultipleObjectsEx have a millisecond precision

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5d0301b9e240b6efa089635629135dcb69ee9383
---

 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);
 }



More information about the vlc-commits mailing list