11 #ifndef ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP 12 #define ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/call_stack.hpp" 19 #include "asio/detail/completion_handler.hpp" 20 #include "asio/detail/fenced_block.hpp" 21 #include "asio/detail/handler_alloc_helpers.hpp" 22 #include "asio/detail/handler_invoke_helpers.hpp" 23 #include "asio/detail/memory.hpp" 25 #include "asio/detail/push_options.hpp" 30 inline strand_service::strand_impl::strand_impl()
31 : operation(&strand_service::do_complete),
44 impl_->ready_queue_.push(impl_->waiting_queue_);
45 bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty();
46 impl_->mutex_.unlock();
49 io_context_impl_->post_immediate_completion(impl_,
false);
53 template <
typename Handler>
61 asio_handler_invoke_helpers::invoke(handler, handler);
67 typename op::ptr p = { asio::detail::addressof(handler),
68 op::ptr::allocate(handler), 0 };
69 p.p =
new (p.v) op(handler, io_context_.get_executor());
71 ASIO_HANDLER_CREATION((this->
context(),
72 *p.p,
"strand", impl, 0,
"dispatch"));
74 bool dispatch_immediately = do_dispatch(impl, p.p);
78 if (dispatch_immediately)
92 template <
typename Handler>
96 bool is_continuation =
97 asio_handler_cont_helpers::is_continuation(handler);
101 typename op::ptr p = { asio::detail::addressof(handler),
102 op::ptr::allocate(handler), 0 };
103 p.p =
new (p.v) op(handler, io_context_.get_executor());
105 ASIO_HANDLER_CREATION((this->
context(),
106 *p.p,
"strand", impl, 0,
"post"));
108 do_post(impl, p.p, is_continuation);
115 #include "asio/detail/pop_options.hpp" 117 #endif // ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP Definition: strand_service.hpp:44
Definition: strand_service.hpp:36
Definition: null_fenced_block.hpp:25
Class to represent an error code value.
Definition: error_code.hpp:80
Definition: call_stack.hpp:30
execution_context & context()
Get the context object that owns the service.
Definition: execution_context.hpp:100
Definition: call_stack.hpp:34
Definition: any_io_executor.hpp:28
Definition: scheduler.hpp:38
Definition: completion_handler.hpp:31