| 29 | namespace detail { |
| 30 | |
| 31 | class initiate_dispatch |
| 32 | { |
| 33 | public: |
| 34 | template <typename CompletionHandler> |
| 35 | void operator()(ASIO_MOVE_ARG(CompletionHandler) handler, |
| 36 | typename enable_if< |
| 37 | execution::is_executor< |
| 38 | typename associated_executor< |
| 39 | typename decay<CompletionHandler>::type |
| 40 | >::type |
| 41 | >::value |
| 42 | >::type* = 0) const |
| 43 | { |
| 44 | typedef typename decay<CompletionHandler>::type handler_t; |
| 45 | |
| 46 | typename associated_executor<handler_t>::type ex( |
| 47 | (get_associated_executor)(handler)); |
| 48 | |
| 49 | typename associated_allocator<handler_t>::type alloc( |
| 50 | (get_associated_allocator)(handler)); |
| 51 | |
| 52 | execution::execute( |
| 53 | asio::prefer(ex, |
| 54 | execution::blocking.possibly, |
| 55 | execution::allocator(alloc)), |
| 56 | asio::detail::bind_handler( |
| 57 | ASIO_MOVE_CAST(CompletionHandler)(handler))); |
| 58 | } |
| 59 | |
| 60 | template <typename CompletionHandler> |
| 61 | void operator()(ASIO_MOVE_ARG(CompletionHandler) handler, |
| 62 | typename enable_if< |
| 63 | !execution::is_executor< |
| 64 | typename associated_executor< |
| 65 | typename decay<CompletionHandler>::type |
| 66 | >::type |
| 67 | >::value |
| 68 | >::type* = 0) const |
| 69 | { |
| 70 | typedef typename decay<CompletionHandler>::type handler_t; |
| 71 | |
| 72 | typename associated_executor<handler_t>::type ex( |
| 73 | (get_associated_executor)(handler)); |
| 74 | |
| 75 | typename associated_allocator<handler_t>::type alloc( |
| 76 | (get_associated_allocator)(handler)); |
| 77 | |
| 78 | ex.dispatch(asio::detail::bind_handler( |
| 79 | ASIO_MOVE_CAST(CompletionHandler)(handler)), alloc); |
| 80 | } |
| 81 | }; |
| 82 | |
| 83 | template <typename Executor> |
| 84 | class initiate_dispatch_with_executor |
no outgoing calls
no test coverage detected