[host] windows: add delayExecution function for more accurate sleeps

This change not only exposes and allows use of NtDelayExecution, but
also moves the code to set the system timer resolution.
This commit is contained in:
Geoffrey McRae
2021-07-17 14:55:22 +10:00
parent e228165ff9
commit 411a6b1e49
6 changed files with 105 additions and 14 deletions

View File

@@ -19,6 +19,7 @@
*/
#include "windows/mousehook.h"
#include "windows/delay.h"
#include "common/windebug.h"
#include "platform.h"
@@ -104,7 +105,7 @@ static DWORD WINAPI updateThreadProc(LPVOID lParam)
mouseHook.callback(mouseHook.x, mouseHook.y);
// limit this to 1000Hz, who has a mouse that updates faster anyway?
Sleep(1);
delayExecution(1.0f);
break;
}
}