summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2018-12-16 14:51:39 -0500
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-02-11 20:59:16 +0200
commit913bddf18fa33b54cdb6e30ebd290363e33e7f47 (patch)
treeb705aa266fb7d813b969def665bd935637e7d885
parent6c3507d6d358485c2a8e2fc4d915847cbeda3ee3 (diff)
SL-10190: Slightly reduce conditional clutter in llcoros.{h,cpp}.
Rename 'winlevel()' to 'sehandle()'; change it from a static member function to a free function, thus eliminating the conditional in llcoros.h. Elsewhere than Windows, provide a zero-cost pass-through sehandle() implementation, eliminating the conditional in toplevel(). # Conflicts: # indra/llcommon/llcoros.cpp # indra/llcommon/llcoros.h
-rw-r--r--indra/llcommon/llcoros.cpp22
-rw-r--r--indra/llcommon/llcoros.h3
2 files changed, 15 insertions, 10 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp
index a182d305e8..51cf2138cb 100644
--- a/indra/llcommon/llcoros.cpp
+++ b/indra/llcommon/llcoros.cpp
@@ -277,6 +277,9 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
return name;
}
+namespace
+{
+
#if LL_WINDOWS
static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
@@ -295,7 +298,7 @@ U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
}
}
-void LLCoros::winlevel(const callable_t& callable)
+void sehandle(const LLCoros::callable_t& callable)
{
__try
{
@@ -312,7 +315,16 @@ void LLCoros::winlevel(const callable_t& callable)
}
}
-#endif
+#else // ! LL_WINDOWS
+
+inline void sehandle(const LLCoros::callable_t& callable)
+{
+ callable();
+}
+
+#endif // ! LL_WINDOWS
+
+} // anonymous namespace
// Top-level wrapper around caller's coroutine callable.
// Normally we like to pass strings and such by const reference -- but in this
@@ -327,11 +339,7 @@ void LLCoros::toplevel(std::string name, callable_t callable)
// run the code the caller actually wants in the coroutine
try
{
-#if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD
- winlevel(callable);
-#else
- callable();
-#endif
+ sehandle(callable);
}
catch (const Stop& exc)
{
diff --git a/indra/llcommon/llcoros.h b/indra/llcommon/llcoros.h
index 59b2b91f96..966ce03296 100644
--- a/indra/llcommon/llcoros.h
+++ b/indra/llcommon/llcoros.h
@@ -309,9 +309,6 @@ private:
std::string generateDistinctName(const std::string& prefix) const;
void toplevel(std::string name, callable_t callable);
struct CoroData;
-#if LL_WINDOWS
- static void winlevel(const callable_t& callable);
-#endif
static CoroData& get_CoroData(const std::string& caller);
void saveException(const std::string& name, std::exception_ptr exc);