Skip to content

#5612 [Win] Reduce delays on resource access for main thread - #5616

Merged
akleshchev merged 1 commit into
developfrom
andreyk/5612_delays
Apr 7, 2026
Merged

#5612 [Win] Reduce delays on resource access for main thread#5616
akleshchev merged 1 commit into
developfrom
andreyk/5612_delays

Conversation

@akleshchev

Copy link
Copy Markdown
Contributor

Our main thread was of normal priority, despite being a render thread, so it was forced to compete for some of the resources. Give it high priority.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR increases the scheduling priority of the Windows main/render thread to reduce contention and improve responsiveness during resource access.

Changes:

  • Adds helper methods on LLWindowWin32 to raise/lower the current thread priority.
  • Sets the main thread to high priority during LLWindowWin32 construction.
  • Adjusts thread priority on minimize/restore transitions before invoking activation callbacks.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
indra/llwindow/llwindowwin32.h Declares new setThreadPriorityHigh/Normal helpers on LLWindowWin32.
indra/llwindow/llwindowwin32.cpp Applies thread priority changes at startup and on window minimize/restore; implements the new helpers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread indra/llwindow/llwindowwin32.cpp Outdated
Comment thread indra/llwindow/llwindowwin32.cpp Outdated
}
else
{
LL_INFOS() << "Failed to set thread priority: " << std::hex << GetLastError() << LL_ENDL;

Copilot AI Apr 6, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The failure log for SetThreadPriority is using LL_INFOS() without the "Window" tag, while other error paths in this file use LL_WARNS("Window") (e.g., failed ReleaseDC, failed destroy). Please make this logging consistent (category/tag and severity) so failures can be filtered and noticed appropriately.

Suggested change
LL_INFOS() << "Failed to set thread priority: " << std::hex << GetLastError() << LL_ENDL;
LL_WARNS("Window") << "Failed to set thread priority: " << std::hex << GetLastError() << LL_ENDL;

Copilot uses AI. Check for mistakes.
Comment thread indra/llwindow/llwindowwin32.cpp Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread indra/llwindow/llwindowwin32.cpp
Comment thread indra/llwindow/llwindowwin32.cpp
Comment thread indra/llwindow/llwindowwin32.cpp Outdated
Comment thread indra/llwindow/llwindowwin32.cpp Outdated
Our main thread was of normal priority, despite being a render thread, so it was forced to compete for some of the resources. Give it high priority.
@akleshchev
akleshchev force-pushed the andreyk/5612_delays branch from 5332270 to 0785407 Compare April 6, 2026 23:24
@akleshchev
akleshchev merged commit 321a6e9 into develop Apr 7, 2026
9 of 10 checks passed
@akleshchev
akleshchev deleted the andreyk/5612_delays branch April 7, 2026 00:25
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants