mirror of
https://github.com/CalcProgrammer1/OpenRGB.git
synced 2026-05-18 11:35:21 -04:00
Update timer resolution every 500ms to ensure it stays set while OpenRGB is active
This commit is contained in:
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);
|
||||
|
||||
Reference in New Issue
Block a user