From b3708ac238d51eaf808cb77a4493e518c1593e33 Mon Sep 17 00:00:00 2001
From: Nat Goodspeed <nat@lindenlab.com>
Date: Mon, 17 May 2021 15:10:06 -0400
Subject: [PATCH] SL-15200: Use new LLApp::sleep() in
 LLPurgeDiskCacheThread::run().

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

diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp
index c0f10ac6200..6b0bbaeb48b 100644
--- a/indra/llfilesystem/lldiskcache.cpp
+++ b/indra/llfilesystem/lldiskcache.cpp
@@ -31,6 +31,7 @@
  */
 
 #include "linden_common.h"
+#include "llapp.h"
 #include "llassettype.h"
 #include "lldir.h"
 #include <boost/filesystem.hpp>
@@ -371,17 +372,10 @@ LLPurgeDiskCacheThread::LLPurgeDiskCacheThread() :
 
 void LLPurgeDiskCacheThread::run()
 {
-    constexpr F64 CHECK_INTERVAL = 60;
-    mTimer.setTimerExpirySec(CHECK_INTERVAL);
-    mTimer.start();
+    constexpr long CHECK_INTERVAL = 60;
 
-    do
+    while (LLApp::instance()->sleep(std::chrono::seconds(CHECK_INTERVAL)))
     {
-        if (mTimer.checkExpirationAndReset(CHECK_INTERVAL))
-        {
-            LLDiskCache::instance().purge();
-        }
-
-        ms_sleep(100);
-    } while (!isQuitting());
+        LLDiskCache::instance().purge();
+    }
 }
diff --git a/indra/llfilesystem/lldiskcache.h b/indra/llfilesystem/lldiskcache.h
index 268fe92bcc6..1cbd2c58aa6 100644
--- a/indra/llfilesystem/lldiskcache.h
+++ b/indra/llfilesystem/lldiskcache.h
@@ -194,8 +194,5 @@ class LLPurgeDiskCacheThread : public LLThread
 
 protected:
     void run() override;
-
-private:
-    LLTimer mTimer;
 };
 #endif // _LLDISKCACHE
-- 
GitLab