/
usr
/
include
/
boost
/
asio
/
detail
/
impl
/
/usr/include/boost/asio/detail/impl
mkdir
upload
Name
Size
Mode
Actions
buffer_sequence_adapter.ipp
3096
0644
edit
dl
rm
descriptor_ops.ipp
15091
0644
edit
dl
rm
dev_poll_reactor.hpp
2587
0644
edit
dl
rm
dev_poll_reactor.ipp
13138
0644
edit
dl
rm
epoll_reactor.hpp
2439
0644
edit
dl
rm
epoll_reactor.ipp
22372
0644
edit
dl
rm
eventfd_select_interrupter.ipp
4598
0644
edit
dl
rm
handler_tracking.ipp
11782
0644
edit
dl
rm
kqueue_reactor.hpp
2590
0644
edit
dl
rm
kqueue_reactor.ipp
17045
0644
edit
dl
rm
null_event.ipp
1906
0644
edit
dl
rm
pipe_select_interrupter.ipp
3176
0644
edit
dl
rm
posix_event.ipp
1776
0644
edit
dl
rm
posix_mutex.ipp
1235
0644
edit
dl
rm
posix_thread.ipp
1964
0644
edit
dl
rm
posix_tss_ptr.ipp
1261
0644
edit
dl
rm
reactive_descriptor_service.ipp
6388
0644
edit
dl
rm
reactive_serial_port_service.ipp
4278
0644
edit
dl
rm
reactive_socket_service_base.ipp
8802
0644
edit
dl
rm
resolver_service_base.ipp
3891
0644
edit
dl
rm
scheduler.ipp
15892
0644
edit
dl
rm
select_reactor.hpp
2985
0644
edit
dl
rm
select_reactor.ipp
9352
0644
edit
dl
rm
service_registry.hpp
2652
0644
edit
dl
rm
service_registry.ipp
5462
0644
edit
dl
rm
signal_set_service.ipp
20376
0644
edit
dl
rm
socket_ops.ipp
113798
0644
edit
dl
rm
socket_select_interrupter.ipp
5858
0644
edit
dl
rm
strand_executor_service.hpp
11570
0644
edit
dl
rm
strand_executor_service.ipp
3637
0644
edit
dl
rm
strand_service.hpp
3574
0644
edit
dl
rm
strand_service.ipp
5037
0644
edit
dl
rm
throw_error.ipp
1268
0644
edit
dl
rm
timer_queue_ptime.ipp
2410
0644
edit
dl
rm
timer_queue_set.ipp
2317
0644
edit
dl
rm
winrt_ssocket_service_base.ipp
17513
0644
edit
dl
rm
winrt_timer_scheduler.hpp
2664
0644
edit
dl
rm
winrt_timer_scheduler.ipp
2962
0644
edit
dl
rm
winsock_init.ipp
2050
0644
edit
dl
rm
win_event.ipp
2068
0644
edit
dl
rm
win_iocp_handle_service.ipp
14394
0644
edit
dl
rm
win_iocp_io_context.hpp
3026
0644
edit
dl
rm
win_iocp_io_context.ipp
16634
0644
edit
dl
rm
win_iocp_serial_port_service.ipp
6021
0644
edit
dl
rm
win_iocp_socket_service_base.ipp
25041
0644
edit
dl
rm
win_mutex.ipp
2213
0644
edit
dl
rm
win_object_handle_service.ipp
12495
0644
edit
dl
rm
win_static_mutex.ipp
3636
0644
edit
dl
rm
win_thread.ipp
4102
0644
edit
dl
rm
win_tss_ptr.ipp
1448
0644
edit
dl
rm
Edit:
/usr/include/boost/asio/detail/impl/strand_service.hpp
(3574B)
// // detail/impl/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2020 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) // #ifndef BOOST_ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP #define BOOST_ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/completion_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> #include <boost/asio/detail/memory.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { inline strand_service::strand_impl::strand_impl() : operation(&strand_service::do_complete), locked_(false) { } struct strand_service::on_dispatch_exit { io_context_impl* io_context_impl_; strand_impl* impl_; ~on_dispatch_exit() { impl_->mutex_.lock(); impl_->ready_queue_.push(impl_->waiting_queue_); bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty(); impl_->mutex_.unlock(); if (more_handlers) io_context_impl_->post_immediate_completion(impl_, false); } }; template <typename Handler> void strand_service::dispatch(strand_service::implementation_type& impl, Handler& handler) { // If we are already in the strand then the handler can run immediately. if (call_stack<strand_impl>::contains(impl)) { fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); return; } // Allocate and construct an operation to wrap the handler. typedef completion_handler<Handler, io_context::executor_type> op; typename op::ptr p = { boost::asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler, io_context_.get_executor()); BOOST_ASIO_HANDLER_CREATION((this->context(), *p.p, "strand", impl, 0, "dispatch")); bool dispatch_immediately = do_dispatch(impl, p.p); operation* o = p.p; p.v = p.p = 0; if (dispatch_immediately) { // Indicate that this strand is executing on the current thread. call_stack<strand_impl>::context ctx(impl); // Ensure the next handler, if any, is scheduled on block exit. on_dispatch_exit on_exit = { &io_context_impl_, impl }; (void)on_exit; op::do_complete(&io_context_impl_, o, boost::system::error_code(), 0); } } // Request the io_context to invoke the given handler and return immediately. template <typename Handler> void strand_service::post(strand_service::implementation_type& impl, Handler& handler) { bool is_continuation = boost_asio_handler_cont_helpers::is_continuation(handler); // Allocate and construct an operation to wrap the handler. typedef completion_handler<Handler, io_context::executor_type> op; typename op::ptr p = { boost::asio::detail::addressof(handler), op::ptr::allocate(handler), 0 }; p.p = new (p.v) op(handler, io_context_.get_executor()); BOOST_ASIO_HANDLER_CREATION((this->context(), *p.p, "strand", impl, 0, "post")); do_post(impl, p.p, is_continuation); p.v = p.p = 0; } } // namespace detail } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_DETAIL_IMPL_STRAND_SERVICE_HPP
Save
cmd:
run