From ec5009d70eb0fd729126b2321b9d7d6118741573 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Thu, 13 Oct 2022 19:51:40 -0500 Subject: SL-18190 Potential fix for sapping CPU when "sleeping" --- indra/llwindow/llwindowwin32.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index aadf895271..6beb874e8c 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -66,6 +66,7 @@ #include #include +#include // Require DirectInput version 8 #define DIRECTINPUT_VERSION 0x0800 @@ -4827,6 +4828,14 @@ void LLWindowWin32::LLWindowWin32Thread::run() initDX(); + //as good a place as any to up the MM timer resolution (see ms_sleep) + //attempt to set timer resolution to 1ms + TIMECAPS tc; + if (timeGetDevCaps(&tc, sizeof(TIMECAPS)) == TIMERR_NOERROR) + { + timeBeginPeriod(llclamp((U32) 1, tc.wPeriodMin, tc.wPeriodMax)); + } + while (! getQueue().done()) { LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32; -- cgit v1.2.3