diff options
| author | Nicky <nicky.dasmijn@gmail.com> | 2022-04-18 19:57:34 +0200 |
|---|---|---|
| committer | Nicky <nicky.dasmijn@gmail.com> | 2022-04-18 19:57:34 +0200 |
| commit | ca839307f9edb5f5b6807a2a7185733518c241cf (patch) | |
| tree | abec0f3c2b8aa5a8f821f306e19b5a54599a275f /indra/llcommon/llcoros.cpp | |
| parent | 2b151e0aefd54671e1be504269f10318d303dccb (diff) | |
| parent | dbb044e9bb1c3d155ceb6736e2d6c9c1360b4882 (diff) | |
Merge remote-tracking branch 'origin/DRTVWR-543-maint' into DRTVWR-543-maint_cmake
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 75fc0fec99..c2d353b0fc 100644 --- a/indra/llcommon/llcoros.cpp +++ b/indra/llcommon/llcoros.cpp @@ -249,14 +249,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; } |
