diff options
author | Rong Xu <xur@google.com> | 2014-09-02 15:29:57 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-09-02 15:29:57 -0700 |
commit | e97c99f15937e5762a973b25192aab824126a6d3 (patch) | |
tree | 7f0be3ff7c7d976af06887dc50accd68f7630a7f /gcc-4.9/libstdc++-v3/include/std/future | |
parent | f1c18afafc2b321465ae6b07ede127095942d7dc (diff) | |
download | toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.zip toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.gz toolchain_gcc-e97c99f15937e5762a973b25192aab824126a6d3.tar.bz2 |
[gcc-4.9] Merge svn r214745 from google/gcc-4_9 branch.
Merge gcc-4_9 source r214745 from google/gcc-4_9 branch.
Change-Id: Ie6fa0fd72f4b4eec3adc4db4bb922e652d1c2605
Diffstat (limited to 'gcc-4.9/libstdc++-v3/include/std/future')
-rw-r--r-- | gcc-4.9/libstdc++-v3/include/std/future | 20 |
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 998e90a..d446b9d 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; + } } }; } |