diff options
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include/std')
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/std/condition_variable | 9 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/std/future | 20 | ||||
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/std/mutex | 3 |
3 files changed, 30 insertions, 2 deletions
diff --git a/gcc-4.9/libstdc++-v3/include/std/condition_variable b/gcc-4.9/libstdc++-v3/include/std/condition_variable index fc111dd3d..921cb837d 100644 --- a/gcc-4.9/libstdc++-v3/include/std/condition_variable +++ b/gcc-4.9/libstdc++-v3/include/std/condition_variable @@ -189,7 +189,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ~_Unlock() noexcept(false) { if (uncaught_exception()) - __try { _M_lock.lock(); } __catch(...) { } + { + __try + { _M_lock.lock(); } + __catch(const __cxxabiv1::__forced_unwind&) + { __throw_exception_again; } + __catch(...) + { } + } else _M_lock.lock(); } diff --git a/gcc-4.9/libstdc++-v3/include/std/future b/gcc-4.9/libstdc++-v3/include/std/future index 998e90a98..d446b9d55 100644 --- a/gcc-4.9/libstdc++-v3/include/std/future +++ b/gcc-4.9/libstdc++-v3/include/std/future @@ -1240,6 +1240,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_result->_M_set(_M_fn()); } + __catch(const __cxxabiv1::__forced_unwind&) + { + __throw_exception_again; // will cause broken_promise + } __catch(...) { _M_result->_M_error = current_exception(); @@ -1259,6 +1263,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_fn(); } + __catch(const __cxxabiv1::__forced_unwind&) + { + __throw_exception_again; // will cause broken_promise + } __catch(...) { _M_result->_M_error = current_exception(); @@ -1519,7 +1527,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_result(new _Result<_Res>()), _M_fn(std::move(__fn)) { _M_thread = std::thread{ [this] { - _M_set_result(_S_task_setter(_M_result, _M_fn)); + __try + { + _M_set_result(_S_task_setter(_M_result, _M_fn)); + } + __catch (const __cxxabiv1::__forced_unwind&) + { + // make the shared state ready on thread cancellation + if (static_cast<bool>(_M_result)) + this->_M_break_promise(std::move(_M_result)); + __throw_exception_again; + } } }; } diff --git a/gcc-4.9/libstdc++-v3/include/std/mutex b/gcc-4.9/libstdc++-v3/include/std/mutex index 0b481d609..8e9dd27e2 100644 --- a/gcc-4.9/libstdc++-v3/include/std/mutex +++ b/gcc-4.9/libstdc++-v3/include/std/mutex @@ -44,6 +44,7 @@ #include <bits/functexcept.h> #include <bits/gthr.h> #include <bits/move.h> // for std::swap +#include <bits/cxxabi_forced.h> #ifdef _GLIBCXX_USE_C99_STDINT_TR1 @@ -649,6 +650,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION auto __locks = std::tie(__l1, __l2, __l3...); __try { __try_lock_impl<0>::__do_try_lock(__locks, __idx); } + __catch(const __cxxabiv1::__forced_unwind&) + { __throw_exception_again; } __catch(...) { } return __idx; |