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.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131639 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/mutex b/include/mutex
index fcfe4b7..69192a8 100644
--- a/include/mutex
+++ b/include/mutex
@@ -485,7 +485,7 @@
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
- _STD::move(_STD::get<0>(__f_))(_STD::move(_STD::get<_Indices>(__f_))...);
+ __invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
}
};