Преглед на файлове

pipeline: Don't use Sleep(1) to yield on Windows

Use Sleep(0) instead.  Sleep(0) is not guaranteed to yield, which is a problem, but Sleep(1) can easily take up to 16 ms, which is really unacceptable except in very low-priority thread.  But really, you shouldn't be relying on force_yield() for anything except with the SIMPLE_THREADS model.

There is also SwitchToThread(), but in fact it is even weaker than Sleep(0).
rdb преди 3 години
родител
ревизия
c2d088f232
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      panda/src/pipeline/threadWin32Impl.I

+ 1 - 1
panda/src/pipeline/threadWin32Impl.I

@@ -76,7 +76,7 @@ sleep(double seconds) {
  */
 INLINE void ThreadWin32Impl::
 yield() {
-  Sleep(1);
+  Sleep(0);
 }
 
 /**