summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 20:59:19 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2013-11-20 20:59:19 +0000
commite95391f67ab448fda23c6ec5f29d473992ac45ec (patch)
tree52b3906db49c694dccf669aa2f545f7476b715f0 /libstdc++-v3/src
parent7619e6123badd33990e4d1ed7dd19a4c25a2c88e (diff)
downloadppe42-gcc-e95391f67ab448fda23c6ec5f29d473992ac45ec.tar.gz
ppe42-gcc-e95391f67ab448fda23c6ec5f29d473992ac45ec.zip
PR libstdc++/49204
* include/std/future (__future_base::_State_base): Rename to __future_base::_State_baseV2. (__future_base::_State_baseV2::~_State_baseV2): Define as defaulted. (__future_base::_State_baseV2::_M_run_deferred): Rename to _M_complete_async. (__future_base::_State_baseV2::_M_has_deferred): Add new virtual. (__future_base::_State_baseV2::wait_for): Call _M_has_deferred() to test for a deferred function, or call _M_complete_async() to join an async thread that has made the shared state ready. (__future_base::_State_baseV2::wait_until): Likewise. (__future_base::_Async_state_common): Rename to _Async_state_commonV2. (__future_base::_Async_state_commonV2::_M_run_deferred): Rename to _M_complete_async. * src/c++11/compatibility-thread-c++0x.cc (__future_base::_State_base): Export old definition. (__future_base::_Async_state_common): Likewise. * src/c++11/future.cc (__future_base::_State_base::~_State_base): Remove. * doc/xml/manual/status_cxx2011.xml: Update status. * testsuite/30_threads/async/async.cc: Test future_status::timeout and future_status::ready. * testsuite/30_threads/async/sync.cc: Test future_status::deferred. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@205144 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc37
-rw-r--r--libstdc++-v3/src/c++11/future.cc2
2 files changed, 33 insertions, 6 deletions
diff --git a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
index ecc4ca4b558..bec7a2b6a64 100644
--- a/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
+++ b/libstdc++-v3/src/c++11/compatibility-thread-c++0x.cc
@@ -23,7 +23,7 @@
// <http://www.gnu.org/licenses/>.
#include <bits/c++config.h>
-#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED)
+#if defined(_GLIBCXX_SHARED)
#define _GLIBCXX_ASYNC_ABI_COMPAT
#endif
@@ -78,20 +78,49 @@ _GLIBCXX_ASM_SYMVER(_ZN9__gnu_cxx11try_to_lockE, _ZSt11try_to_lock, GLIBCXX_3.4.
// XXX GLIBCXX_ABI Deprecated
-// gcc-4.7.0
+// gcc-4.7.0, gcc-4.9.0
// <future> export changes
#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
&& (ATOMIC_INT_LOCK_FREE > 1)
-#if defined(_GLIBCXX_HAVE_TLS) && defined(_GLIBCXX_SHARED)
+#if defined(_GLIBCXX_SHARED)
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+ // Replaced by _State_baseV2 in gcc-4.9.0
+ class __future_base::_State_base
+ {
+ typedef _Ptr<_Result_base> _Ptr_type;
+
+ _Ptr_type _M_result;
+ mutex _M_mutex;
+ condition_variable _M_cond;
+ atomic_flag _M_retrieved;
+ once_flag _M_once;
+ public:
+ virtual ~_State_base();
+ virtual void _M_run_deferred() { }
+ };
+ __future_base::_State_base::~_State_base() { }
+
+ // Replaced by _Async_state_commonV2 in gcc-4.9.0
+ class __future_base::_Async_state_common : public __future_base::_State_base
+ {
+ protected:
+ ~_Async_state_common();
+ virtual void _M_run_deferred() { _M_join(); }
+ void _M_join() { std::call_once(_M_once, &thread::join, ref(_M_thread)); }
+ thread _M_thread;
+ once_flag _M_once;
+ };
+#if defined(_GLIBCXX_HAVE_TLS)
+ // Replaced with inline definition in gcc-4.8.0
__future_base::_Async_state_common::~_Async_state_common() { _M_join(); }
// Explicit instantiation due to -fno-implicit-instantiation.
template void call_once(once_flag&, void (thread::*&&)(), reference_wrapper<thread>&&);
template _Bind_simple_helper<void (thread::*)(), reference_wrapper<thread>>::__type __bind_simple(void (thread::*&&)(), reference_wrapper<thread>&&);
+#endif // _GLIBCXX_HAVE_TLS
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace std
-#endif
+#endif // _GLIBCXX_SHARED
#endif // _GLIBCXX_HAS_GTHREADS && _GLIBCXX_USE_C99_STDINT_TR1
diff --git a/libstdc++-v3/src/c++11/future.cc b/libstdc++-v3/src/c++11/future.cc
index 906ded5476f..e253ac3cee9 100644
--- a/libstdc++-v3/src/c++11/future.cc
+++ b/libstdc++-v3/src/c++11/future.cc
@@ -82,8 +82,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
__future_base::_Result_base::_Result_base() = default;
__future_base::_Result_base::~_Result_base() = default;
-
- __future_base::_State_base::~_State_base() = default;
#endif
_GLIBCXX_END_NAMESPACE_VERSION
OpenPOWER on IntegriCloud