summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-04-03 02:11:51 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2026-04-03 22:30:26 +0300
commit3078b209ff2cddde993b9827d1a77bdd997f31ab (patch)
tree60c0569c1e251332bdf00e2ff4542b0f76f0d3fe /indra
parent5b485bdc6046867e8b03906e8bdd0f02471f9fa8 (diff)
#5612 Fix fast cache freezing main thread
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llviewertexturelist.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index bfa662e5ef..e4fd947892 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1200,8 +1200,18 @@ F32 LLViewerTextureList::updateImagesLoadingFastCache(F32 max_time)
LLTimer timer;
image_list_t::iterator enditer = mFastCacheList.begin();
{
- // prelock fast cache mutex to avoid waiting multiple times.
- LLMutexLock cache_lock(LLAppViewer::getTextureCache()->getFastCacheMutex());
+ // Prelock fast cache mutex to avoid waiting multiple times.
+ LLMutexTrylock fast_cache_lock(LLAppViewer::getTextureCache()->getFastCacheMutex());
+ if (!fast_cache_lock.isLocked())
+ {
+ // Cache is busy, skip this update cycle to avoid blocking the main thread.
+ //
+ // Generally fast cache operations are brief and rare in comparison to writing
+ // main texture body, but if disk is busy, it can get stuck for multiple
+ // seconds, waiting for that long is not practical.
+ // But some variant of a timed try lock for 0.1ms or less might be optimal.
+ return 0.0f;
+ }
for (image_list_t::iterator iter = mFastCacheList.begin();
iter != mFastCacheList.end();)
{