summaryrefslogtreecommitdiff
path: root/boost/fiber/future/async.hpp
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:08:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-09-13 11:09:00 +0900
commitb5c87084afaef42b2d058f68091be31988a6a874 (patch)
treeadef9a65870a41181687e11d57fdf98e7629de3c /boost/fiber/future/async.hpp
parent34bd32e225e2a8a94104489b31c42e5801cc1f4a (diff)
downloadboost-b5c87084afaef42b2d058f68091be31988a6a874.tar.gz
boost-b5c87084afaef42b2d058f68091be31988a6a874.tar.bz2
boost-b5c87084afaef42b2d058f68091be31988a6a874.zip
Imported Upstream version 1.64.0upstream/1.64.0
Change-Id: Id9212edd016dd55f21172c427aa7894d1d24148b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/fiber/future/async.hpp')
-rw-r--r--boost/fiber/future/async.hpp78
1 files changed, 50 insertions, 28 deletions
diff --git a/boost/fiber/future/async.hpp b/boost/fiber/future/async.hpp
index d969d19ce3..e68b2c28fa 100644
--- a/boost/fiber/future/async.hpp
+++ b/boost/fiber/future/async.hpp
@@ -23,63 +23,85 @@ namespace fibers {
template< typename Fn, typename ... Args >
future<
- typename std::result_of<
- typename std::enable_if<
- ! detail::is_launch_policy< typename std::decay< Fn >::type >::value,
- typename std::decay< Fn >::type
- >::type( typename std::decay< Args >::type ... )
- >::type
+ typename std::result_of<
+ typename std::enable_if<
+ ! detail::is_launch_policy< typename std::decay< Fn >::type >::value,
+ typename std::decay< Fn >::type
+ >::type( typename std::decay< Args >::type ... )
+ >::type
>
async( Fn && fn, Args && ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
- >::type result_t;
+ >::type result_type;
- packaged_task< result_t( typename std::decay< Args >::type ... ) > pt{
+ packaged_task< result_type( typename std::decay< Args >::type ... ) > pt{
std::forward< Fn >( fn) };
- future< result_t > f{ pt.get_future() };
+ future< result_type > f{ pt.get_future() };
fiber{ std::move( pt), std::forward< Args >( args) ... }.detach();
return f;
}
template< typename Policy, typename Fn, typename ... Args >
future<
- typename std::result_of<
- typename std::enable_if<
- detail::is_launch_policy< Policy >::value,
- typename std::decay< Fn >::type
- >::type( typename std::decay< Args >::type ...)
- >::type
+ typename std::result_of<
+ typename std::enable_if<
+ detail::is_launch_policy< Policy >::value,
+ typename std::decay< Fn >::type
+ >::type( typename std::decay< Args >::type ...)
+ >::type
>
async( Policy policy, Fn && fn, Args && ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
- >::type result_t;
+ >::type result_type;
- packaged_task< result_t( typename std::decay< Args >::type ... ) > pt{
+ packaged_task< result_type( typename std::decay< Args >::type ... ) > pt{
std::forward< Fn >( fn) };
- future< result_t > f{ pt.get_future() };
+ future< result_type > f{ pt.get_future() };
fiber{ policy, std::move( pt), std::forward< Args >( args) ... }.detach();
return f;
}
template< typename Policy, typename StackAllocator, typename Fn, typename ... Args >
future<
- typename std::result_of<
- typename std::enable_if<
- detail::is_launch_policy< Policy >::value,
- typename std::decay< Fn >::type
- >::type( typename std::decay< Args >::type ... )
- >::type
+ typename std::result_of<
+ typename std::enable_if<
+ detail::is_launch_policy< Policy >::value,
+ typename std::decay< Fn >::type
+ >::type( typename std::decay< Args >::type ... )
+ >::type
>
async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Fn && fn, Args && ... args) {
typedef typename std::result_of<
typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
- >::type result_t;
+ >::type result_type;
- packaged_task< result_t( typename std::decay< Args >::type ... ) > pt{
- std::allocator_arg, salloc, std::forward< Fn >( fn) };
- future< result_t > f{ pt.get_future() };
+ packaged_task< result_type( typename std::decay< Args >::type ... ) > pt{
+ std::forward< Fn >( fn) };
+ future< result_type > f{ pt.get_future() };
+ fiber{ policy, std::allocator_arg, salloc,
+ std::move( pt), std::forward< Args >( args) ... }.detach();
+ return f;
+}
+
+template< typename Policy, typename StackAllocator, typename Allocator, typename Fn, typename ... Args >
+future<
+ typename std::result_of<
+ typename std::enable_if<
+ detail::is_launch_policy< Policy >::value,
+ typename std::decay< Fn >::type
+ >::type( typename std::decay< Args >::type ... )
+ >::type
+>
+async( Policy policy, std::allocator_arg_t, StackAllocator salloc, Allocator alloc, Fn && fn, Args && ... args) {
+ typedef typename std::result_of<
+ typename std::decay< Fn >::type( typename std::decay< Args >::type ... )
+ >::type result_type;
+
+ packaged_task< result_type( typename std::decay< Args >::type ... ) > pt{
+ std::allocator_arg, alloc, std::forward< Fn >( fn) };
+ future< result_type > f{ pt.get_future() };
fiber{ policy, std::allocator_arg, salloc,
std::move( pt), std::forward< Args >( args) ... }.detach();
return f;