Raise priority of system events thread

This commit is contained in:
ergo720 2023-03-12 10:52:35 +01:00 committed by RadWolfie
parent 87496ab873
commit 1504a75a46
1 changed files with 4 additions and 0 deletions

View File

@ -158,6 +158,10 @@ static uint64_t get_next(uint64_t now)
xbox::void_xt NTAPI system_events(xbox::PVOID arg)
{
// Testing shows that, if this thread has the same priority of the other xbox threads, it can take tens, even hundreds of ms to complete a single loop.
// So we increase its priority to above normal, so that it completes a loop roughly every 3.1ms
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
while (true) {
const uint64_t nearest_next = get_next(get_now());
QueryPerformanceCounter(reinterpret_cast<LARGE_INTEGER *>(&last_time));