[vlc-commits] win32: only sleep for 0 ms when excplicitly requested

Steve Lhomme git at videolan.org
Sat Jun 4 15:40:50 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue May 31 15:06:19 2016 +0200| [ac7d450ad01e555b959667b2c29312402436b56a] | committer: Jean-Baptiste Kempf

win32: only sleep for 0 ms when excplicitly requested

SleepEx(0) results in 100% CPU usage on XP. It's back to normal with a 5 ms
value.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 src/win32/thread.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/win32/thread.c b/src/win32/thread.c
index 632d3e0..963a8d7 100644
--- a/src/win32/thread.c
+++ b/src/win32/thread.c
@@ -314,7 +314,7 @@ static BOOL WINAPI SleepConditionVariableFallback(CONDITION_VARIABLE *cv,
 {
     (void) cv;
     LeaveCriticalSection(cs);
-    SleepEx(0, TRUE);
+    SleepEx(ms > 5 ? 5 : ms, TRUE);
     EnterCriticalSection(cs);
     return ms != 0;
 }



More information about the vlc-commits mailing list