// impl/post.hpp
// ~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2022 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
boost::asio::require(ex, execution::blocking.never),
execution::relationship.fork,
execution::allocator(alloc)),
- BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+ boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)));
}
template <typename CompletionHandler>
typename associated_allocator<handler_t>::type alloc(
(get_associated_allocator)(handler));
- ex.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
+ ex.post(boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
}
};
execution::is_executor<
typename conditional<true, executor_type, CompletionHandler>::type
>::value
- &&
+ >::type* = 0,
+ typename enable_if<
!detail::is_work_dispatcher_required<
typename decay<CompletionHandler>::type,
Executor
boost::asio::require(ex_, execution::blocking.never),
execution::relationship.fork,
execution::allocator(alloc)),
- BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler));
+ boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)));
}
template <typename CompletionHandler>
execution::is_executor<
typename conditional<true, executor_type, CompletionHandler>::type
>::value
- &&
+ >::type* = 0,
+ typename enable_if<
detail::is_work_dispatcher_required<
typename decay<CompletionHandler>::type,
Executor
!execution::is_executor<
typename conditional<true, executor_type, CompletionHandler>::type
>::value
- &&
+ >::type* = 0,
+ typename enable_if<
!detail::is_work_dispatcher_required<
typename decay<CompletionHandler>::type,
Executor
typename associated_allocator<handler_t>::type alloc(
(get_associated_allocator)(handler));
- ex_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler), alloc);
+ ex_.post(boost::asio::detail::bind_handler(
+ BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc);
}
template <typename CompletionHandler>
!execution::is_executor<
typename conditional<true, executor_type, CompletionHandler>::type
>::value
- &&
+ >::type* = 0,
+ typename enable_if<
detail::is_work_dispatcher_required<
typename decay<CompletionHandler>::type,
Executor
} // namespace detail
-template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
-BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
- BOOST_ASIO_MOVE_ARG(CompletionToken) token)
+template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken>
+BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(NullaryToken, void()) post(
+ BOOST_ASIO_MOVE_ARG(NullaryToken) token)
{
- return async_initiate<CompletionToken, void()>(
+ return async_initiate<NullaryToken, void()>(
detail::initiate_post(), token);
}
template <typename Executor,
- BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
-BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
- const Executor& ex, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
- typename enable_if<
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken>
+BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(NullaryToken, void()) post(
+ const Executor& ex, BOOST_ASIO_MOVE_ARG(NullaryToken) token,
+ typename constraint<
execution::is_executor<Executor>::value || is_executor<Executor>::value
- >::type*)
+ >::type)
{
- return async_initiate<CompletionToken, void()>(
+ return async_initiate<NullaryToken, void()>(
detail::initiate_post_with_executor<Executor>(ex), token);
}
template <typename ExecutionContext,
- BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) CompletionToken>
-inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(CompletionToken, void()) post(
- ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(CompletionToken) token,
- typename enable_if<is_convertible<
- ExecutionContext&, execution_context&>::value>::type*)
+ BOOST_ASIO_COMPLETION_TOKEN_FOR(void()) NullaryToken>
+inline BOOST_ASIO_INITFN_AUTO_RESULT_TYPE(NullaryToken, void()) post(
+ ExecutionContext& ctx, BOOST_ASIO_MOVE_ARG(NullaryToken) token,
+ typename constraint<is_convertible<
+ ExecutionContext&, execution_context&>::value>::type)
{
- return async_initiate<CompletionToken, void()>(
+ return async_initiate<NullaryToken, void()>(
detail::initiate_post_with_executor<
typename ExecutionContext::executor_type>(
ctx.get_executor()), token);