2
0
mirror of https://github.com/boostorg/fiber.git synced 2026-02-11 23:52:29 +00:00

extend async() to accept a stack-allocator

This commit is contained in:
Oliver Kowalke
2014-12-28 08:07:31 +01:00
parent 7b3f18becd
commit 4d1f12e333

View File

@@ -30,6 +30,17 @@ async( Fn fn) {
return std::move( f);
}
template< typename StackAllocator, typename Fn >
future< typename std::result_of< Fn() >::type >
async( StackAllocator salloc, Fn fn) {
typedef typename std::result_of< Fn() >::type result_type;
packaged_task< result_type() > pt( std::forward< Fn >( fn) );
future< result_type > f( pt.get_future() );
fiber( salloc, std::move( pt) ).detach();
return std::move( f);
}
}}
#endif // BOOST_FIBERS_ASYNC_HPP