aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3/include/std/future
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include/std/future')
-rw-r--r--gcc-4.9/libstdc++-v3/include/std/future20
1 files changed, 19 insertions, 1 deletions
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;
+ }
} };
}