#6014 Reduce shutdown delays on thread cleanup#6024
Open
akleshchev wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR reduces viewer shutdown delays by allowing long-sleeping/background threads to exit more promptly during cleanup, notably by signaling the watchdog earlier and adding a bounded wait for queued-thread shutdown.
Changes:
- Add
LLWatchdog::shutdown()and call it earlier duringLLAppViewer::cleanup()to reduce watchdog-related shutdown waiting. - Add a timed
LLQueuedThread::waitOnPending(F32 max_time_sec)overload and use it forsTextureFetchshutdown. - Reduce
LLThread::shutdown()polling sleep interval from 100ms to 10ms (6s total wait before forced termination).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| indra/newview/llappviewer.cpp | Signals watchdog shutdown earlier; bounds texture fetch pending-wait during shutdown. |
| indra/llcommon/llwatchdog.h | Declares new LLWatchdog::shutdown() API. |
| indra/llcommon/llwatchdog.cpp | Implements watchdog shutdown and adjusts timer-thread stop behavior. |
| indra/llcommon/llthread.cpp | Decreases shutdown polling sleep interval to reduce teardown delays. |
| indra/llcommon/llqueuedthread.h | Adds timed waitOnPending() overload declaration. |
| indra/llcommon/llqueuedthread.cpp | Implements timed waitOnPending() to prevent unbounded shutdown waits. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+229
to
+237
| void LLWatchdog::shutdown() | ||
| { | ||
| if (mTimer) | ||
| { | ||
| mTimer->stop(); | ||
| // update mLastClockCount to not trip run() | ||
| mLastClockCount = LLTimer::getTotalTime(); | ||
| } | ||
| } |
Contributor
Author
There was a problem hiding this comment.
May be I will just remove the string, but either way, no point locking it. Either thread is already in and will rewrite to a comparable value; thread is about to run and has plenty of time so won't hurt the shutdown; or value gets set and next run will be fast.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
maxim-productengine
approved these changes
Jul 20, 2026
marchcat
approved these changes
Jul 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Viewer runs a lot of different threads and each one was waiting 100ms on shutdown. Watchdog was waiting for internal sleep to finish.