From 8b59d9bb42f7a0421c27daa75672ae775bb8927f Mon Sep 17 00:00:00 2001
From: nat-goodspeed <nat@lindenlab.com>
Date: Wed, 10 Jul 2024 11:15:51 -0400
Subject: Introduce LLCoros::RMutex, use for SettingsConfig::mRecorderMutex
 (#1980)

in llerror.cpp.
---
 indra/llcommon/llcoros.h   | 9 ++++++++-
 indra/llcommon/llerror.cpp | 3 +--
 2 files changed, 9 insertions(+), 3 deletions(-)

(limited to 'indra')

diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h
index 369d65407e..c3820ae987 100644
--- a/indra/llcommon/llcoros.h
+++ b/indra/llcommon/llcoros.h
@@ -31,8 +31,9 @@
 
 #include "llexception.h"
 #include <boost/fiber/fss.hpp>
-#include <boost/fiber/future/promise.hpp>
 #include <boost/fiber/future/future.hpp>
+#include <boost/fiber/future/promise.hpp>
+#include <boost/fiber/recursive_mutex.hpp>
 #include "mutex.h"
 #include "llsingleton.h"
 #include "llinstancetracker.h"
@@ -307,6 +308,12 @@ public:
 
     // use mutex, lock, condition_variable suitable for coroutines
     using Mutex = boost::fibers::mutex;
+    using RMutex = boost::fibers::recursive_mutex;
+    // With C++17, LockType is deprecated: at this point we can directly
+    // declare 'std::unique_lock lk(some_mutex)' without explicitly stating
+    // the mutex type. Sadly, making LockType an alias template for
+    // std::unique_lock doesn't work the same way: Class Template Argument
+    // Deduction only works for class templates, not alias templates.
     using LockType = std::unique_lock<Mutex>;
     using cv_status = boost::fibers::cv_status;
     using ConditionVariable = boost::fibers::condition_variable;
diff --git a/indra/llcommon/llerror.cpp b/indra/llcommon/llerror.cpp
index ff80863497..6c3b9c9542 100644
--- a/indra/llcommon/llerror.cpp
+++ b/indra/llcommon/llerror.cpp
@@ -55,7 +55,6 @@
 #include "llsingleton.h"
 #include "llstl.h"
 #include "lltimer.h"
-#include <boost/fiber/recursive_mutex.hpp>
 
 // On Mac, got:
 // #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define
@@ -507,7 +506,7 @@ namespace
         LLError::TimeFunction               mTimeFunction;
 
         Recorders                           mRecorders;
-        boost::fibers::recursive_mutex      mRecorderMutex;
+        LLCoros::RMutex                     mRecorderMutex;
 
         int                                 mShouldLogCallCounter;
 
-- 
cgit v1.2.3