aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/include/std/future
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely.gcc@gmail.com>2012-08-25 23:01:40 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2012-08-26 00:01:40 +0100
commit277f43d2d0c4554d1c050a8c4e913cbf4d54cf4b (patch)
tree14a840fae3c8a2b3e7a91873a4133ad272af91d9 /libstdc++-v3/include/std/future
parent81ea3024cac22aa75bd589fa455b132895e1a82f (diff)
downloadgcc-277f43d2d0c4554d1c050a8c4e913cbf4d54cf4b.zip
gcc-277f43d2d0c4554d1c050a8c4e913cbf4d54cf4b.tar.gz
gcc-277f43d2d0c4554d1c050a8c4e913cbf4d54cf4b.tar.bz2
re PR libstdc++/54297 ([C++11] Segmentation fault with std::async and released shared state)
PR libstdc++/54297 * include/std/future (~_Async_state_impl): Join thread before derived class members are destroyed. (~_Async_state_common): Only define non-trivial destructor when included from future.cc for ABI compatibility reasons. * src/c++11/future.cc (_GLIBCXX_ABI_COMPAT_ASYNC): Define. * testsuite/30_threads/async/54297.cc: New. From-SVN: r190672
Diffstat (limited to 'libstdc++-v3/include/std/future')
-rw-r--r--libstdc++-v3/include/std/future6
1 files changed, 4 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future
index a8d7112..feae382 100644
--- a/libstdc++-v3/include/std/future
+++ b/libstdc++-v3/include/std/future
@@ -1427,10 +1427,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
class __future_base::_Async_state_common : public __future_base::_State_base
{
protected:
-#ifdef _GLIBCXX_HAVE_TLS
+#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_ABI_COMPAT_ASYNC)
~_Async_state_common();
#else
- ~_Async_state_common() { _M_join(); }
+ ~_Async_state_common() = default;
#endif
// Allow non-timed waiting functions to block until the thread completes,
@@ -1457,6 +1457,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
} };
}
+ ~_Async_state_impl() { _M_join(); }
+
private:
typedef __future_base::_Ptr<_Result<_Res>> _Ptr_type;
_Ptr_type _M_result;