2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-20 14:42:21 +00:00

di not call async() wihtin boost.fiber's async) because of name clash in

MSVC
This commit is contained in:
Oliver Kowalke
2016-05-03 19:01:40 +02:00
parent 43866a4d2e
commit c57d3abeb2

View File

@@ -46,8 +46,15 @@ future<
>::type
>
async( Function && fn, Args && ... args) {
return async( launch_policy::post,
std::forward< Function >( fn), std::forward< Args >( args) ...);
typedef typename std::result_of<
typename std::decay< Function >::type( typename std::decay< Args >::type ... )
>::type result_t;
packaged_task< result_t( typename std::decay< Args >::type ... ) > pt{
std::forward< Function >( fn) };
future< result_t > f{ pt.get_future() };
fiber{ std::move( pt), std::forward< Args >( args) ... }.detach();
return f;
}
template< typename StackAllocator, class Function, class ... Args >
@@ -75,9 +82,15 @@ future<
>::type
>
async( std::allocator_arg_t, StackAllocator salloc, Function && fn, Args && ... args) {
return async( launch_policy::post,
std::allocator_arg, salloc,
std::forward< Function >( fn), std::forward< Args >( args) ...);
typedef typename std::result_of<
typename std::decay< Function >::type( typename std::decay< Args >::type ... )
>::type result_t;
packaged_task< result_t( typename std::decay< Args >::type ... ) > pt{
std::allocator_arg, salloc, std::forward< Function >( fn) };
future< result_t > f{ pt.get_future() };
fiber{ std::move( pt), std::forward< Args >( args) ... }.detach();
return f;
}
}}