diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2025-03-03 22:49:52 +0200 |
|---|---|---|
| committer | Andrey Kleshchev <117672381+akleshchev@users.noreply.github.com> | 2025-03-04 17:23:05 +0200 |
| commit | ed394cd5a07d69e9007ad50819a01911645cadcd (patch) | |
| tree | e227353861b270196117c98f829bea9f3f5e7496 /indra/llcommon/llcoros.cpp | |
| parent | a1ccb44c15b484787bce34e06adb0396bfc6d2a4 (diff) | |
#3591 rethrow should be mac specific
Jumped the gun a bit, since reportCrashToBugsplat is OS specific,
restore rethrow for other systems.
Diffstat (limited to 'indra/llcommon/llcoros.cpp')
| -rw-r--r-- | indra/llcommon/llcoros.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index b16f166d28..ea2d102de9 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -228,6 +228,22 @@ std::string LLCoros::logname() return data.mName.empty()? data.getKey() : data.mName; } +void LLCoros::saveException(const std::string& name, std::exception_ptr exc) +{ + mExceptionQueue.emplace(name, exc); +} + +void LLCoros::rethrow() +{ + if (! mExceptionQueue.empty()) + { + ExceptionData front = mExceptionQueue.front(); + mExceptionQueue.pop(); + LL_WARNS("LLCoros") << "Rethrowing exception from coroutine " << front.name << LL_ENDL; + std::rethrow_exception(front.exception); + } +} + void LLCoros::setStackSize(S32 stacksize) { LL_DEBUGS("LLCoros") << "Setting coroutine stack size to " << stacksize << LL_ENDL; @@ -370,7 +386,16 @@ void LLCoros::toplevel(std::string name, callable_t callable) // viewer will carry on. LOG_UNHANDLED_EXCEPTION(STRINGIZE("coroutine " << name)); } - // uncaught exception by default will cause std::terminate() +#ifndef LL_WINDOWS + catch (...) + { + // Stash any OTHER kind of uncaught exception in the rethrow() queue + // to be rethrown by the main fiber. + LL_WARNS("LLCoros") << "Capturing uncaught exception in coroutine " + << name << LL_ENDL; + LLCoros::instance().saveException(name, std::current_exception()); + } +#endif // ! LL_WINDOWS } //static |
