I had a giant misunderstanding of what 'synchronizes with' meant in [futures.async]/p5. This invalidated the current design of async in <future>. This is a new design, based on my new understanding, which has been confirmed on the lwg mailing list. The summary is that ~future() (and ~shared_future()) will block when they are created from within async, and the thread hasn't finished yet. As part of this work I created two new type traits: __invokable<F, Args...>::value and __invoke_of<F, Args...>::type. These are what result_of<F(Args...)> wanted to be when it grew up, but never will be. __invoke_of is carefully crafted so that it can serve as its own enable_if (type doesn't exist if the signature isn't invokable). All of this work is C++11 only.
llvm-svn: 131639
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: ec0810e1c8e690ebbf571670820392d52fb23b75
diff --git a/include/thread b/include/thread
index ca16d21..a04572f 100644
--- a/include/thread
+++ b/include/thread
@@ -325,7 +325,7 @@
void
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
{
- _STD::move(_STD::get<0>(__t))(_STD::move(_STD::get<_Indices>(__t))...);
+ __invoke(_STD::move(_STD::get<0>(__t)), _STD::move(_STD::get<_Indices>(__t))...);
}
template <class _F>