diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-04-18 20:43:49 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-04-18 20:43:49 +0300 |
commit | 026ad511eaeae74b0273276506ae4b3a29536a5c (patch) | |
tree | e316418eb30f456bd55d3a59a7bd7771d0f2af28 /indra/llcommon/llcoros.cpp | |
parent | a629e845cfff17a9ab7e74dd3930e1fb63ab286b (diff) | |
parent | d031662435d97101411ae990ed85d6e001ab668a (diff) |
Merge branch 'master' into DRTVWR-544-maint
# Conflicts:
# indra/newview/app_settings/settings.xml
# indra/newview/llfloatersearch.cpp
# indra/newview/llgroupactions.cpp
# indra/newview/llvovolume.cpp
Diffstat (limited to 'indra/llcommon/llcoros.cpp')
-rw-r--r-- | indra/llcommon/llcoros.cpp | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/indra/llcommon/llcoros.cpp b/indra/llcommon/llcoros.cpp index ca2e7b38d7..14bfb98629 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -266,14 +266,25 @@ std::string LLCoros::launch(const std::string& prefix, const callable_t& callabl // protected_fixedsize_stack sets a guard page past the end of the new // stack so that stack underflow will result in an access violation // instead of weird, subtle, possibly undiagnosed memory stomps. - boost::fibers::fiber newCoro(boost::fibers::launch::dispatch, - std::allocator_arg, - boost::fibers::protected_fixedsize_stack(mStackSize), - [this, &name, &callable](){ toplevel(name, callable); }); - // You have two choices with a fiber instance: you can join() it or you - // can detach() it. If you try to destroy the instance before doing - // either, the program silently terminates. We don't need this handle. - newCoro.detach(); + + try + { + boost::fibers::fiber newCoro(boost::fibers::launch::dispatch, + std::allocator_arg, + boost::fibers::protected_fixedsize_stack(mStackSize), + [this, &name, &callable]() { toplevel(name, callable); }); + + // You have two choices with a fiber instance: you can join() it or you + // can detach() it. If you try to destroy the instance before doing + // either, the program silently terminates. We don't need this handle. + newCoro.detach(); + } + catch (std::bad_alloc&) + { + // Out of memory on stack allocation? + LL_ERRS("LLCoros") << "Bad memory allocation in LLCoros::launch(" << prefix << ")!" << LL_ENDL; + } + return name; } |