Skip to content
Snippets Groups Projects
Commit 913bddf1 authored by Nat Goodspeed's avatar Nat Goodspeed Committed by Andrey Kleshchev
Browse files

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
parent 6c3507d6
No related branches found
No related tags found
No related merge requests found
...@@ -277,6 +277,9 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl ...@@ -277,6 +277,9 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl
return name; return name;
} }
namespace
{
#if LL_WINDOWS #if LL_WINDOWS
static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
...@@ -295,7 +298,7 @@ U32 exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop) ...@@ -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 __try
{ {
...@@ -312,7 +315,16 @@ void LLCoros::winlevel(const callable_t& callable) ...@@ -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. // Top-level wrapper around caller's coroutine callable.
// Normally we like to pass strings and such by const reference -- but in this // 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) ...@@ -327,11 +339,7 @@ void LLCoros::toplevel(std::string name, callable_t callable)
// run the code the caller actually wants in the coroutine // run the code the caller actually wants in the coroutine
try try
{ {
#if LL_WINDOWS && LL_RELEASE_FOR_DOWNLOAD sehandle(callable);
winlevel(callable);
#else
callable();
#endif
} }
catch (const Stop& exc) catch (const Stop& exc)
{ {
......
...@@ -309,9 +309,6 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros> ...@@ -309,9 +309,6 @@ class LL_COMMON_API LLCoros: public LLSingleton<LLCoros>
std::string generateDistinctName(const std::string& prefix) const; std::string generateDistinctName(const std::string& prefix) const;
void toplevel(std::string name, callable_t callable); void toplevel(std::string name, callable_t callable);
struct CoroData; struct CoroData;
#if LL_WINDOWS
static void winlevel(const callable_t& callable);
#endif
static CoroData& get_CoroData(const std::string& caller); static CoroData& get_CoroData(const std::string& caller);
void saveException(const std::string& name, std::exception_ptr exc); void saveException(const std::string& name, std::exception_ptr exc);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment