From 89cf988aaf0de402641cd945e7e9ad5292bc78d6 Mon Sep 17 00:00:00 2001
From: Ansariel <ansariel.hiller@phoenixviewer.com>
Date: Mon, 17 May 2021 09:49:32 +0200
Subject: [PATCH] BUG-230673: Add warning that LLDiskCache::purge() is also
 called from outside the main thread

---
 indra/llfilesystem/lldiskcache.cpp | 2 ++
 indra/llfilesystem/lldiskcache.h   | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index 68423cc4f87..17906ce3690 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -51,6 +51,8 @@ LLDiskCache::LLDiskCache(const std::string cache_dir,
     LLFile::mkdir(cache_dir);
 }
 
+// WARNING: purge() is called by LLPurgeDiskCacheThread. As such it must
+// NOT touch any LLDiskCache data without introducing and locking a mutex!
 void LLDiskCache::purge()
 {
     if (mEnableCacheDebugInfo)
diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h
index 867a80f3327..7c5b798f7e7 100644
--- a/indra/llfilesystem/lldiskcache.h
+++ b/indra/llfilesystem/lldiskcache.h
@@ -118,6 +118,9 @@ class LLDiskCache :
         /**
          * Purge the oldest items in the cache so that the combined size of all files
          * is no bigger than mMaxSizeBytes.
+         *
+         * WARNING: purge() is called by LLPurgeDiskCacheThread. As such it must
+         * NOT touch any LLDiskCache data without introducing and locking a mutex!
          */
         void purge();
 
-- 
GitLab