mirror of
https://github.com/86Box/86Box.git
synced 2026-02-22 17:45:31 -07:00
Call timeBeginPeriod only once on startup (#6273)
Use SetProcessInformation to make the OS better handle our threads on big/small cores
This commit is contained in:
@@ -98,6 +98,7 @@ extern "C" {
|
||||
#include <86box/timer.h>
|
||||
#include <86box/nvr.h>
|
||||
extern int qt_nvr_save(void);
|
||||
extern void exit_pause(void);
|
||||
|
||||
bool cpu_thread_running = false;
|
||||
}
|
||||
@@ -753,6 +754,14 @@ main(int argc, char *argv[])
|
||||
discord_load();
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// On Win32 the accuracy of Sleep() depends on the timer resolution, which can be set by calling timeBeginPeriod
|
||||
// https://learn.microsoft.com/en-us/windows/win32/api/timeapi/nf-timeapi-timebeginperiod
|
||||
exit_pause();
|
||||
timeBeginPeriod(1);
|
||||
atexit([] () -> void { timeEndPeriod(1); });
|
||||
#endif
|
||||
|
||||
main_window = new MainWindow();
|
||||
if (startMaximized) {
|
||||
main_window->showMaximized();
|
||||
|
||||
Reference in New Issue
Block a user