Update timer resolution every 500ms to ensure it stays set while OpenRGB is active
This commit is contained in:
parent
4b50533560
commit
174b0743a9
1 changed files with 14 additions and 1 deletions
15
main.cpp
15
main.cpp
|
|
@ -15,6 +15,7 @@
|
|||
#include <vector>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <thread>
|
||||
|
||||
#include "OpenRGBDialog2.h"
|
||||
|
||||
|
|
@ -63,6 +64,16 @@ void InitializeTimerResolution()
|
|||
|
||||
NtSetTimerResolution(5000, TRUE, &CurrentResolution);
|
||||
}
|
||||
|
||||
void InitializeTimerResolutionThreadFunction()
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
InitializeTimerResolution();
|
||||
|
||||
std::this_thread::sleep_for(500ms);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************************\
|
||||
|
|
@ -118,7 +129,9 @@ bool AttemptLocalConnection()
|
|||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
InitializeTimerResolution();
|
||||
std::thread * InitializeTimerResolutionThread;
|
||||
InitializeTimerResolutionThread = new std::thread(InitializeTimerResolutionThreadFunction);
|
||||
InitializeTimerResolutionThread->detach();
|
||||
#endif
|
||||
|
||||
ProfileManager profile_manager(rgb_controllers);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue