summaryrefslogtreecommitdiff
path: root/boost/asio/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/detail')
-rw-r--r--boost/asio/detail/array.hpp2
-rw-r--r--boost/asio/detail/array_fwd.hpp2
-rw-r--r--boost/asio/detail/assert.hpp2
-rw-r--r--boost/asio/detail/atomic_count.hpp2
-rw-r--r--boost/asio/detail/base_from_completion_cond.hpp7
-rw-r--r--boost/asio/detail/bind_handler.hpp2
-rw-r--r--boost/asio/detail/buffer_resize_guard.hpp2
-rw-r--r--boost/asio/detail/buffer_sequence_adapter.hpp2
-rw-r--r--boost/asio/detail/buffered_stream_storage.hpp2
-rw-r--r--boost/asio/detail/call_stack.hpp2
-rw-r--r--boost/asio/detail/chrono.hpp2
-rw-r--r--boost/asio/detail/chrono_time_traits.hpp2
-rw-r--r--boost/asio/detail/completion_handler.hpp2
-rw-r--r--boost/asio/detail/concurrency_hint.hpp2
-rw-r--r--boost/asio/detail/conditionally_enabled_event.hpp2
-rw-r--r--boost/asio/detail/conditionally_enabled_mutex.hpp2
-rw-r--r--boost/asio/detail/config.hpp64
-rw-r--r--boost/asio/detail/consuming_buffers.hpp2
-rw-r--r--boost/asio/detail/cstddef.hpp2
-rw-r--r--boost/asio/detail/cstdint.hpp2
-rw-r--r--boost/asio/detail/date_time_fwd.hpp2
-rw-r--r--boost/asio/detail/deadline_timer_service.hpp22
-rw-r--r--boost/asio/detail/dependent_type.hpp2
-rw-r--r--boost/asio/detail/descriptor_ops.hpp2
-rw-r--r--boost/asio/detail/descriptor_read_op.hpp16
-rw-r--r--boost/asio/detail/descriptor_write_op.hpp16
-rw-r--r--boost/asio/detail/dev_poll_reactor.hpp2
-rw-r--r--boost/asio/detail/epoll_reactor.hpp2
-rw-r--r--boost/asio/detail/event.hpp2
-rw-r--r--boost/asio/detail/eventfd_select_interrupter.hpp2
-rw-r--r--boost/asio/detail/executor_function.hpp106
-rw-r--r--boost/asio/detail/executor_op.hpp2
-rw-r--r--boost/asio/detail/fd_set_adapter.hpp2
-rw-r--r--boost/asio/detail/fenced_block.hpp2
-rw-r--r--boost/asio/detail/functional.hpp2
-rw-r--r--boost/asio/detail/future.hpp2
-rw-r--r--boost/asio/detail/gcc_arm_fenced_block.hpp2
-rw-r--r--boost/asio/detail/gcc_hppa_fenced_block.hpp2
-rw-r--r--boost/asio/detail/gcc_sync_fenced_block.hpp2
-rw-r--r--boost/asio/detail/gcc_x86_fenced_block.hpp2
-rw-r--r--boost/asio/detail/global.hpp2
-rw-r--r--boost/asio/detail/handler_alloc_helpers.hpp19
-rw-r--r--boost/asio/detail/handler_cont_helpers.hpp2
-rw-r--r--boost/asio/detail/handler_invoke_helpers.hpp2
-rw-r--r--boost/asio/detail/handler_tracking.hpp2
-rw-r--r--boost/asio/detail/handler_type_requirements.hpp2
-rw-r--r--boost/asio/detail/handler_work.hpp34
-rw-r--r--boost/asio/detail/hash_map.hpp2
-rw-r--r--boost/asio/detail/impl/buffer_sequence_adapter.ipp2
-rw-r--r--boost/asio/detail/impl/descriptor_ops.ipp2
-rw-r--r--boost/asio/detail/impl/dev_poll_reactor.hpp2
-rw-r--r--boost/asio/detail/impl/dev_poll_reactor.ipp2
-rw-r--r--boost/asio/detail/impl/epoll_reactor.hpp2
-rw-r--r--boost/asio/detail/impl/epoll_reactor.ipp2
-rw-r--r--boost/asio/detail/impl/eventfd_select_interrupter.ipp2
-rw-r--r--boost/asio/detail/impl/handler_tracking.ipp2
-rw-r--r--boost/asio/detail/impl/kqueue_reactor.hpp2
-rw-r--r--boost/asio/detail/impl/kqueue_reactor.ipp2
-rw-r--r--boost/asio/detail/impl/null_event.ipp2
-rw-r--r--boost/asio/detail/impl/pipe_select_interrupter.ipp2
-rw-r--r--boost/asio/detail/impl/posix_event.ipp2
-rw-r--r--boost/asio/detail/impl/posix_mutex.ipp2
-rw-r--r--boost/asio/detail/impl/posix_thread.ipp2
-rw-r--r--boost/asio/detail/impl/posix_tss_ptr.ipp2
-rw-r--r--boost/asio/detail/impl/reactive_descriptor_service.ipp8
-rw-r--r--boost/asio/detail/impl/reactive_serial_port_service.ipp8
-rw-r--r--boost/asio/detail/impl/reactive_socket_service_base.ipp7
-rw-r--r--boost/asio/detail/impl/resolver_service_base.ipp64
-rw-r--r--boost/asio/detail/impl/scheduler.ipp54
-rw-r--r--boost/asio/detail/impl/select_reactor.hpp2
-rw-r--r--boost/asio/detail/impl/select_reactor.ipp2
-rw-r--r--boost/asio/detail/impl/service_registry.hpp2
-rw-r--r--boost/asio/detail/impl/service_registry.ipp2
-rw-r--r--boost/asio/detail/impl/signal_set_service.ipp42
-rw-r--r--boost/asio/detail/impl/socket_ops.ipp9
-rw-r--r--boost/asio/detail/impl/socket_select_interrupter.ipp2
-rw-r--r--boost/asio/detail/impl/strand_executor_service.hpp2
-rw-r--r--boost/asio/detail/impl/strand_executor_service.ipp2
-rw-r--r--boost/asio/detail/impl/strand_service.hpp2
-rw-r--r--boost/asio/detail/impl/strand_service.ipp2
-rw-r--r--boost/asio/detail/impl/throw_error.ipp2
-rw-r--r--boost/asio/detail/impl/timer_queue_ptime.ipp2
-rw-r--r--boost/asio/detail/impl/timer_queue_set.ipp2
-rw-r--r--boost/asio/detail/impl/win_event.ipp2
-rw-r--r--boost/asio/detail/impl/win_iocp_handle_service.ipp9
-rw-r--r--boost/asio/detail/impl/win_iocp_io_context.hpp2
-rw-r--r--boost/asio/detail/impl/win_iocp_io_context.ipp43
-rw-r--r--boost/asio/detail/impl/win_iocp_serial_port_service.ipp8
-rw-r--r--boost/asio/detail/impl/win_iocp_socket_service_base.ipp10
-rw-r--r--boost/asio/detail/impl/win_mutex.ipp2
-rw-r--r--boost/asio/detail/impl/win_object_handle_service.ipp35
-rw-r--r--boost/asio/detail/impl/win_static_mutex.ipp2
-rw-r--r--boost/asio/detail/impl/win_thread.ipp2
-rw-r--r--boost/asio/detail/impl/win_tss_ptr.ipp2
-rw-r--r--boost/asio/detail/impl/winrt_ssocket_service_base.ipp30
-rw-r--r--boost/asio/detail/impl/winrt_timer_scheduler.hpp8
-rw-r--r--boost/asio/detail/impl/winrt_timer_scheduler.ipp15
-rw-r--r--boost/asio/detail/impl/winsock_init.ipp2
-rw-r--r--boost/asio/detail/io_control.hpp2
-rw-r--r--boost/asio/detail/io_object_executor.hpp162
-rw-r--r--boost/asio/detail/io_object_impl.hpp195
-rw-r--r--boost/asio/detail/is_buffer_sequence.hpp51
-rw-r--r--boost/asio/detail/is_executor.hpp2
-rw-r--r--boost/asio/detail/keyword_tss_ptr.hpp2
-rw-r--r--boost/asio/detail/kqueue_reactor.hpp2
-rw-r--r--boost/asio/detail/local_free_on_block_exit.hpp2
-rw-r--r--boost/asio/detail/macos_fenced_block.hpp2
-rw-r--r--boost/asio/detail/memory.hpp2
-rw-r--r--boost/asio/detail/mutex.hpp2
-rw-r--r--boost/asio/detail/non_const_lvalue.hpp56
-rw-r--r--boost/asio/detail/noncopyable.hpp2
-rw-r--r--boost/asio/detail/null_event.hpp2
-rw-r--r--boost/asio/detail/null_fenced_block.hpp2
-rw-r--r--boost/asio/detail/null_global.hpp2
-rw-r--r--boost/asio/detail/null_mutex.hpp2
-rw-r--r--boost/asio/detail/null_reactor.hpp2
-rw-r--r--boost/asio/detail/null_signal_blocker.hpp2
-rw-r--r--boost/asio/detail/null_socket_service.hpp115
-rw-r--r--boost/asio/detail/null_static_mutex.hpp2
-rw-r--r--boost/asio/detail/null_thread.hpp2
-rw-r--r--boost/asio/detail/null_tss_ptr.hpp2
-rw-r--r--boost/asio/detail/object_pool.hpp2
-rw-r--r--boost/asio/detail/old_win_sdk_compat.hpp2
-rw-r--r--boost/asio/detail/op_queue.hpp2
-rw-r--r--boost/asio/detail/operation.hpp2
-rw-r--r--boost/asio/detail/pipe_select_interrupter.hpp2
-rw-r--r--boost/asio/detail/pop_options.hpp14
-rw-r--r--boost/asio/detail/posix_event.hpp4
-rw-r--r--boost/asio/detail/posix_fd_set_adapter.hpp2
-rw-r--r--boost/asio/detail/posix_global.hpp2
-rw-r--r--boost/asio/detail/posix_mutex.hpp2
-rw-r--r--boost/asio/detail/posix_signal_blocker.hpp2
-rw-r--r--boost/asio/detail/posix_static_mutex.hpp2
-rw-r--r--boost/asio/detail/posix_thread.hpp2
-rw-r--r--boost/asio/detail/posix_tss_ptr.hpp2
-rw-r--r--boost/asio/detail/push_options.hpp14
-rw-r--r--boost/asio/detail/reactive_descriptor_service.hpp53
-rw-r--r--boost/asio/detail/reactive_null_buffers_op.hpp14
-rw-r--r--boost/asio/detail/reactive_serial_port_service.hpp24
-rw-r--r--boost/asio/detail/reactive_socket_accept_op.hpp51
-rw-r--r--boost/asio/detail/reactive_socket_connect_op.hpp15
-rw-r--r--boost/asio/detail/reactive_socket_recv_op.hpp18
-rw-r--r--boost/asio/detail/reactive_socket_recvfrom_op.hpp16
-rw-r--r--boost/asio/detail/reactive_socket_recvmsg_op.hpp15
-rw-r--r--boost/asio/detail/reactive_socket_send_op.hpp18
-rw-r--r--boost/asio/detail/reactive_socket_sendto_op.hpp16
-rw-r--r--boost/asio/detail/reactive_socket_service.hpp115
-rw-r--r--boost/asio/detail/reactive_socket_service_base.hpp83
-rw-r--r--boost/asio/detail/reactive_wait_op.hpp14
-rw-r--r--boost/asio/detail/reactor.hpp2
-rw-r--r--boost/asio/detail/reactor_fwd.hpp2
-rw-r--r--boost/asio/detail/reactor_op.hpp2
-rw-r--r--boost/asio/detail/reactor_op_queue.hpp2
-rw-r--r--boost/asio/detail/recycling_allocator.hpp30
-rw-r--r--boost/asio/detail/regex_fwd.hpp2
-rw-r--r--boost/asio/detail/resolve_endpoint_op.hpp36
-rw-r--r--boost/asio/detail/resolve_op.hpp2
-rw-r--r--boost/asio/detail/resolve_query_op.hpp34
-rw-r--r--boost/asio/detail/resolver_service.hpp36
-rw-r--r--boost/asio/detail/resolver_service_base.hpp41
-rw-r--r--boost/asio/detail/scheduler.hpp15
-rw-r--r--boost/asio/detail/scheduler_operation.hpp2
-rw-r--r--boost/asio/detail/scheduler_thread_info.hpp2
-rw-r--r--boost/asio/detail/scoped_lock.hpp2
-rw-r--r--boost/asio/detail/scoped_ptr.hpp2
-rw-r--r--boost/asio/detail/select_interrupter.hpp2
-rw-r--r--boost/asio/detail/select_reactor.hpp2
-rw-r--r--boost/asio/detail/service_registry.hpp2
-rw-r--r--boost/asio/detail/signal_blocker.hpp2
-rw-r--r--boost/asio/detail/signal_handler.hpp14
-rw-r--r--boost/asio/detail/signal_init.hpp2
-rw-r--r--boost/asio/detail/signal_op.hpp2
-rw-r--r--boost/asio/detail/signal_set_service.hpp36
-rw-r--r--boost/asio/detail/socket_holder.hpp2
-rw-r--r--boost/asio/detail/socket_ops.hpp2
-rw-r--r--boost/asio/detail/socket_option.hpp2
-rw-r--r--boost/asio/detail/socket_select_interrupter.hpp2
-rw-r--r--boost/asio/detail/socket_types.hpp2
-rw-r--r--boost/asio/detail/solaris_fenced_block.hpp2
-rw-r--r--boost/asio/detail/static_mutex.hpp2
-rw-r--r--boost/asio/detail/std_event.hpp2
-rw-r--r--boost/asio/detail/std_fenced_block.hpp2
-rw-r--r--boost/asio/detail/std_global.hpp2
-rw-r--r--boost/asio/detail/std_mutex.hpp2
-rw-r--r--boost/asio/detail/std_static_mutex.hpp2
-rw-r--r--boost/asio/detail/std_thread.hpp2
-rw-r--r--boost/asio/detail/strand_executor_service.hpp2
-rw-r--r--boost/asio/detail/strand_service.hpp2
-rw-r--r--boost/asio/detail/string_view.hpp2
-rw-r--r--boost/asio/detail/thread.hpp2
-rw-r--r--boost/asio/detail/thread_context.hpp2
-rw-r--r--boost/asio/detail/thread_group.hpp8
-rw-r--r--boost/asio/detail/thread_info_base.hpp11
-rw-r--r--boost/asio/detail/throw_error.hpp2
-rw-r--r--boost/asio/detail/throw_exception.hpp2
-rw-r--r--boost/asio/detail/timer_queue.hpp2
-rw-r--r--boost/asio/detail/timer_queue_base.hpp2
-rw-r--r--boost/asio/detail/timer_queue_ptime.hpp2
-rw-r--r--boost/asio/detail/timer_queue_set.hpp2
-rw-r--r--boost/asio/detail/timer_scheduler.hpp2
-rw-r--r--boost/asio/detail/timer_scheduler_fwd.hpp2
-rw-r--r--boost/asio/detail/tss_ptr.hpp2
-rw-r--r--boost/asio/detail/type_traits.hpp2
-rw-r--r--boost/asio/detail/variadic_templates.hpp16
-rw-r--r--boost/asio/detail/wait_handler.hpp16
-rw-r--r--boost/asio/detail/wait_op.hpp2
-rw-r--r--boost/asio/detail/win_event.hpp2
-rw-r--r--boost/asio/detail/win_fd_set_adapter.hpp2
-rw-r--r--boost/asio/detail/win_fenced_block.hpp2
-rw-r--r--boost/asio/detail/win_global.hpp13
-rw-r--r--boost/asio/detail/win_iocp_handle_read_op.hpp16
-rw-r--r--boost/asio/detail/win_iocp_handle_service.hpp72
-rw-r--r--boost/asio/detail/win_iocp_handle_write_op.hpp15
-rw-r--r--boost/asio/detail/win_iocp_io_context.hpp14
-rw-r--r--boost/asio/detail/win_iocp_null_buffers_op.hpp14
-rw-r--r--boost/asio/detail/win_iocp_operation.hpp2
-rw-r--r--boost/asio/detail/win_iocp_overlapped_op.hpp14
-rw-r--r--boost/asio/detail/win_iocp_overlapped_ptr.hpp42
-rw-r--r--boost/asio/detail/win_iocp_serial_port_service.hpp24
-rw-r--r--boost/asio/detail/win_iocp_socket_accept_op.hpp41
-rw-r--r--boost/asio/detail/win_iocp_socket_connect_op.hpp15
-rw-r--r--boost/asio/detail/win_iocp_socket_recv_op.hpp15
-rw-r--r--boost/asio/detail/win_iocp_socket_recvfrom_op.hpp16
-rw-r--r--boost/asio/detail/win_iocp_socket_recvmsg_op.hpp15
-rw-r--r--boost/asio/detail/win_iocp_socket_send_op.hpp15
-rw-r--r--boost/asio/detail/win_iocp_socket_service.hpp132
-rw-r--r--boost/asio/detail/win_iocp_socket_service_base.hpp101
-rw-r--r--boost/asio/detail/win_iocp_thread_info.hpp2
-rw-r--r--boost/asio/detail/win_iocp_wait_op.hpp14
-rw-r--r--boost/asio/detail/win_mutex.hpp2
-rw-r--r--boost/asio/detail/win_object_handle_service.hpp35
-rw-r--r--boost/asio/detail/win_static_mutex.hpp2
-rw-r--r--boost/asio/detail/win_thread.hpp2
-rw-r--r--boost/asio/detail/win_tss_ptr.hpp2
-rw-r--r--boost/asio/detail/winapp_thread.hpp2
-rw-r--r--boost/asio/detail/wince_thread.hpp2
-rw-r--r--boost/asio/detail/winrt_async_manager.hpp39
-rw-r--r--boost/asio/detail/winrt_async_op.hpp2
-rw-r--r--boost/asio/detail/winrt_resolve_op.hpp15
-rw-r--r--boost/asio/detail/winrt_resolver_service.hpp54
-rw-r--r--boost/asio/detail/winrt_socket_connect_op.hpp14
-rw-r--r--boost/asio/detail/winrt_socket_recv_op.hpp15
-rw-r--r--boost/asio/detail/winrt_socket_send_op.hpp15
-rw-r--r--boost/asio/detail/winrt_ssocket_service.hpp23
-rw-r--r--boost/asio/detail/winrt_ssocket_service_base.hpp59
-rw-r--r--boost/asio/detail/winrt_timer_scheduler.hpp26
-rw-r--r--boost/asio/detail/winrt_utils.hpp2
-rw-r--r--boost/asio/detail/winsock_init.hpp2
-rw-r--r--boost/asio/detail/work_dispatcher.hpp7
-rw-r--r--boost/asio/detail/wrapped_handler.hpp2
250 files changed, 2071 insertions, 1139 deletions
diff --git a/boost/asio/detail/array.hpp b/boost/asio/detail/array.hpp
index 238118e3a6..6779e484b9 100644
--- a/boost/asio/detail/array.hpp
+++ b/boost/asio/detail/array.hpp
@@ -2,7 +2,7 @@
// detail/array.hpp
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/array_fwd.hpp b/boost/asio/detail/array_fwd.hpp
index 82f357785d..25a0c61496 100644
--- a/boost/asio/detail/array_fwd.hpp
+++ b/boost/asio/detail/array_fwd.hpp
@@ -2,7 +2,7 @@
// detail/array_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/assert.hpp b/boost/asio/detail/assert.hpp
index fe306ce614..927dfce76f 100644
--- a/boost/asio/detail/assert.hpp
+++ b/boost/asio/detail/assert.hpp
@@ -2,7 +2,7 @@
// detail/assert.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/atomic_count.hpp b/boost/asio/detail/atomic_count.hpp
index 78cd0fb333..ba945a9e0f 100644
--- a/boost/asio/detail/atomic_count.hpp
+++ b/boost/asio/detail/atomic_count.hpp
@@ -2,7 +2,7 @@
// detail/atomic_count.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/base_from_completion_cond.hpp b/boost/asio/detail/base_from_completion_cond.hpp
index 88f167f3f4..7904eadc91 100644
--- a/boost/asio/detail/base_from_completion_cond.hpp
+++ b/boost/asio/detail/base_from_completion_cond.hpp
@@ -2,7 +2,7 @@
// detail/base_from_completion_cond.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,8 +28,9 @@ template <typename CompletionCondition>
class base_from_completion_cond
{
protected:
- explicit base_from_completion_cond(CompletionCondition completion_condition)
- : completion_condition_(completion_condition)
+ explicit base_from_completion_cond(CompletionCondition& completion_condition)
+ : completion_condition_(
+ BOOST_ASIO_MOVE_CAST(CompletionCondition)(completion_condition))
{
}
diff --git a/boost/asio/detail/bind_handler.hpp b/boost/asio/detail/bind_handler.hpp
index 39f1b29bcd..ddeb58fadc 100644
--- a/boost/asio/detail/bind_handler.hpp
+++ b/boost/asio/detail/bind_handler.hpp
@@ -2,7 +2,7 @@
// detail/bind_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/buffer_resize_guard.hpp b/boost/asio/detail/buffer_resize_guard.hpp
index ad07f72c04..198e9c7dc0 100644
--- a/boost/asio/detail/buffer_resize_guard.hpp
+++ b/boost/asio/detail/buffer_resize_guard.hpp
@@ -2,7 +2,7 @@
// detail/buffer_resize_guard.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/buffer_sequence_adapter.hpp b/boost/asio/detail/buffer_sequence_adapter.hpp
index 5ba55d266d..f33d3426ac 100644
--- a/boost/asio/detail/buffer_sequence_adapter.hpp
+++ b/boost/asio/detail/buffer_sequence_adapter.hpp
@@ -2,7 +2,7 @@
// detail/buffer_sequence_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/buffered_stream_storage.hpp b/boost/asio/detail/buffered_stream_storage.hpp
index 3b9ca404c4..2e060ce5f2 100644
--- a/boost/asio/detail/buffered_stream_storage.hpp
+++ b/boost/asio/detail/buffered_stream_storage.hpp
@@ -2,7 +2,7 @@
// detail/buffered_stream_storage.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/call_stack.hpp b/boost/asio/detail/call_stack.hpp
index 34f4de607f..eb63e54729 100644
--- a/boost/asio/detail/call_stack.hpp
+++ b/boost/asio/detail/call_stack.hpp
@@ -2,7 +2,7 @@
// detail/call_stack.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/chrono.hpp b/boost/asio/detail/chrono.hpp
index 044f12c6c3..d5a55ff4e1 100644
--- a/boost/asio/detail/chrono.hpp
+++ b/boost/asio/detail/chrono.hpp
@@ -2,7 +2,7 @@
// detail/chrono.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/chrono_time_traits.hpp b/boost/asio/detail/chrono_time_traits.hpp
index 256389acaf..85e3b8b429 100644
--- a/boost/asio/detail/chrono_time_traits.hpp
+++ b/boost/asio/detail/chrono_time_traits.hpp
@@ -2,7 +2,7 @@
// detail/chrono_time_traits.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/completion_handler.hpp b/boost/asio/detail/completion_handler.hpp
index e856a86f5a..3cd136974e 100644
--- a/boost/asio/detail/completion_handler.hpp
+++ b/boost/asio/detail/completion_handler.hpp
@@ -2,7 +2,7 @@
// detail/completion_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/concurrency_hint.hpp b/boost/asio/detail/concurrency_hint.hpp
index c11b7f6109..99deb78644 100644
--- a/boost/asio/detail/concurrency_hint.hpp
+++ b/boost/asio/detail/concurrency_hint.hpp
@@ -2,7 +2,7 @@
// detail/concurrency_hint.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/conditionally_enabled_event.hpp b/boost/asio/detail/conditionally_enabled_event.hpp
index 9319c87538..2d5a45c02e 100644
--- a/boost/asio/detail/conditionally_enabled_event.hpp
+++ b/boost/asio/detail/conditionally_enabled_event.hpp
@@ -2,7 +2,7 @@
// detail/conditionally_enabled_event.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/conditionally_enabled_mutex.hpp b/boost/asio/detail/conditionally_enabled_mutex.hpp
index ab4ef48afc..5d105e9814 100644
--- a/boost/asio/detail/conditionally_enabled_mutex.hpp
+++ b/boost/asio/detail/conditionally_enabled_mutex.hpp
@@ -2,7 +2,7 @@
// detail/conditionally_enabled_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/config.hpp b/boost/asio/detail/config.hpp
index 2453425315..8fef292b00 100644
--- a/boost/asio/detail/config.hpp
+++ b/boost/asio/detail/config.hpp
@@ -2,7 +2,7 @@
// detail/config.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -120,11 +120,14 @@
#endif // !defined(BOOST_ASIO_HAS_MOVE)
// If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define
-// BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue
-// references and perfect forwarding.
+// * BOOST_ASIO_MOVE_ARG,
+// * BOOST_ASIO_NONDEDUCED_MOVE_ARG, and
+// * BOOST_ASIO_MOVE_CAST
+// to take advantage of rvalue references and perfect forwarding.
#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
# define BOOST_ASIO_MOVE_ARG(type) type&&
# define BOOST_ASIO_MOVE_ARG2(type1, type2) type1, type2&&
+# define BOOST_ASIO_NONDEDUCED_MOVE_ARG(type) type&
# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&>
# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<type1, type2&&>
#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST)
@@ -150,6 +153,7 @@
# else
# define BOOST_ASIO_MOVE_ARG(type) type
# endif
+# define BOOST_ASIO_NONDEDUCED_MOVE_ARG(type) const type&
# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&>
# define BOOST_ASIO_MOVE_CAST2(type1, type2) static_cast<const type1, type2&>
#endif // !defined(BOOST_ASIO_MOVE_CAST)
@@ -280,9 +284,9 @@
# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4)
# endif // defined(__GNUC__)
# if defined(BOOST_ASIO_MSVC)
-# if (_MSC_VER >= 1700)
+# if (_MSC_VER >= 1800)
# define BOOST_ASIO_HAS_DECLTYPE 1
-# endif // (_MSC_VER >= 1700)
+# endif // (_MSC_VER >= 1800)
# endif // defined(BOOST_ASIO_MSVC)
# endif // !defined(BOOST_ASIO_DISABLE_DECLTYPE)
#endif // !defined(BOOST_ASIO_HAS_DECLTYPE)
@@ -446,7 +450,13 @@
# if __has_include(<atomic>)
# define BOOST_ASIO_HAS_STD_ATOMIC 1
# endif // __has_include(<atomic>)
-# endif // (__cplusplus >= 201103)
+# elif defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
+# if (__clang_major__ >= 10)
+# if __has_include(<atomic>)
+# define BOOST_ASIO_HAS_STD_ATOMIC 1
+# endif // __has_include(<atomic>)
+# endif // (__clang_major__ >= 10)
+# endif /// defined(__apple_build_version__) && defined(_LIBCPP_VERSION)
# endif // defined(__clang__)
# if defined(__GNUC__)
# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4)
@@ -922,15 +932,15 @@
# if defined(_MSC_VER) || defined(__BORLANDC__)
# pragma message( \
"Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately. For example:\n"\
- "- add -D_WIN32_WINNT=0x0501 to the compiler command line; or\n"\
- "- add _WIN32_WINNT=0x0501 to your project's Preprocessor Definitions.\n"\
- "Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).")
+ "- add -D_WIN32_WINNT=0x0601 to the compiler command line; or\n"\
+ "- add _WIN32_WINNT=0x0601 to your project's Preprocessor Definitions.\n"\
+ "Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).")
# else // defined(_MSC_VER) || defined(__BORLANDC__)
# warning Please define _WIN32_WINNT or _WIN32_WINDOWS appropriately.
-# warning For example, add -D_WIN32_WINNT=0x0501 to the compiler command line.
-# warning Assuming _WIN32_WINNT=0x0501 (i.e. Windows XP target).
+# warning For example, add -D_WIN32_WINNT=0x0601 to the compiler command line.
+# warning Assuming _WIN32_WINNT=0x0601 (i.e. Windows 7 target).
# endif // defined(_MSC_VER) || defined(__BORLANDC__)
-# define _WIN32_WINNT 0x0501
+# define _WIN32_WINNT 0x0601
# endif // !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS)
# if defined(_MSC_VER)
# if defined(_WIN32) && !defined(WIN32)
@@ -1001,7 +1011,8 @@
|| defined(__FreeBSD__) \
|| defined(__NetBSD__) \
|| defined(__OpenBSD__) \
- || defined(__linux__)
+ || defined(__linux__) \
+ || defined(__HAIKU__)
# define BOOST_ASIO_HAS_UNISTD_H 1
# endif
# endif // !defined(BOOST_ASIO_HAS_BOOST_CONFIG)
@@ -1365,33 +1376,6 @@
// || (defined(__MACH__) && defined(__APPLE__))
#endif // !defined(BOOST_ASIO_DISABLE_SSIZE_T)
-// Helper macros to manage the transition away from the old services-based API.
-#if defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
-# define BOOST_ASIO_SVC_TPARAM , typename Service
-# define BOOST_ASIO_SVC_TPARAM_DEF1(d1) , typename Service d1
-# define BOOST_ASIO_SVC_TPARAM_DEF2(d1, d2) , typename Service d1, d2
-# define BOOST_ASIO_SVC_TARG , Service
-# define BOOST_ASIO_SVC_T Service
-# define BOOST_ASIO_SVC_TPARAM1 , typename Service1
-# define BOOST_ASIO_SVC_TPARAM1_DEF1(d1) , typename Service1 d1
-# define BOOST_ASIO_SVC_TPARAM1_DEF2(d1, d2) , typename Service1 d1, d2
-# define BOOST_ASIO_SVC_TARG1 , Service1
-# define BOOST_ASIO_SVC_T1 Service1
-# define BOOST_ASIO_SVC_ACCESS public
-#else // defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
-# define BOOST_ASIO_SVC_TPARAM
-# define BOOST_ASIO_SVC_TPARAM_DEF1(d1)
-# define BOOST_ASIO_SVC_TPARAM_DEF2(d1, d2)
-# define BOOST_ASIO_SVC_TARG
-// BOOST_ASIO_SVC_T is defined at each point of use.
-# define BOOST_ASIO_SVC_TPARAM1
-# define BOOST_ASIO_SVC_TPARAM1_DEF1(d1)
-# define BOOST_ASIO_SVC_TPARAM1_DEF2(d1, d2)
-# define BOOST_ASIO_SVC_TARG1
-// BOOST_ASIO_SVC_T1 is defined at each point of use.
-# define BOOST_ASIO_SVC_ACCESS protected
-#endif // defined(BOOST_ASIO_ENABLE_OLD_SERVICES)
-
// Helper macros to manage transition away from error_code return values.
#if defined(BOOST_ASIO_NO_DEPRECATED)
# define BOOST_ASIO_SYNC_OP_VOID void
diff --git a/boost/asio/detail/consuming_buffers.hpp b/boost/asio/detail/consuming_buffers.hpp
index 38eb00576c..f8226a4e8d 100644
--- a/boost/asio/detail/consuming_buffers.hpp
+++ b/boost/asio/detail/consuming_buffers.hpp
@@ -2,7 +2,7 @@
// detail/consuming_buffers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/cstddef.hpp b/boost/asio/detail/cstddef.hpp
index 665ff3b3a3..b77d9aab7f 100644
--- a/boost/asio/detail/cstddef.hpp
+++ b/boost/asio/detail/cstddef.hpp
@@ -2,7 +2,7 @@
// detail/cstddef.hpp
// ~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/cstdint.hpp b/boost/asio/detail/cstdint.hpp
index 24e203aa6d..b916f78a74 100644
--- a/boost/asio/detail/cstdint.hpp
+++ b/boost/asio/detail/cstdint.hpp
@@ -2,7 +2,7 @@
// detail/cstdint.hpp
// ~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/date_time_fwd.hpp b/boost/asio/detail/date_time_fwd.hpp
index b6c49c75d1..c917be4ffb 100644
--- a/boost/asio/detail/date_time_fwd.hpp
+++ b/boost/asio/detail/date_time_fwd.hpp
@@ -2,7 +2,7 @@
// detail/date_time_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/deadline_timer_service.hpp b/boost/asio/detail/deadline_timer_service.hpp
index ff162493d8..8732990a0f 100644
--- a/boost/asio/detail/deadline_timer_service.hpp
+++ b/boost/asio/detail/deadline_timer_service.hpp
@@ -2,7 +2,7 @@
// detail/deadline_timer_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -18,7 +18,7 @@
#include <boost/asio/detail/config.hpp>
#include <cstddef>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/fenced_block.hpp>
#include <boost/asio/detail/memory.hpp>
@@ -44,7 +44,7 @@ namespace detail {
template <typename Time_Traits>
class deadline_timer_service
- : public service_base<deadline_timer_service<Time_Traits> >
+ : public execution_context_service_base<deadline_timer_service<Time_Traits> >
{
public:
// The time type.
@@ -64,9 +64,10 @@ public:
};
// Constructor.
- deadline_timer_service(boost::asio::io_context& io_context)
- : service_base<deadline_timer_service<Time_Traits> >(io_context),
- scheduler_(boost::asio::use_service<timer_scheduler>(io_context))
+ deadline_timer_service(execution_context& context)
+ : execution_context_service_base<
+ deadline_timer_service<Time_Traits> >(context),
+ scheduler_(boost::asio::use_service<timer_scheduler>(context))
{
scheduler_.init_task();
scheduler_.add_timer_queue(timer_queue_);
@@ -226,14 +227,15 @@ public:
}
// Start an asynchronous wait on the timer.
- template <typename Handler>
- void async_wait(implementation_type& impl, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_wait(implementation_type& impl,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef wait_handler<Handler> op;
+ typedef wait_handler<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
impl.might_have_pending_waits = true;
diff --git a/boost/asio/detail/dependent_type.hpp b/boost/asio/detail/dependent_type.hpp
index 43f87dae7f..53aef3fb5f 100644
--- a/boost/asio/detail/dependent_type.hpp
+++ b/boost/asio/detail/dependent_type.hpp
@@ -2,7 +2,7 @@
// detail/dependent_type.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/descriptor_ops.hpp b/boost/asio/detail/descriptor_ops.hpp
index bfa6ce99fa..bfb0824ffb 100644
--- a/boost/asio/detail/descriptor_ops.hpp
+++ b/boost/asio/detail/descriptor_ops.hpp
@@ -2,7 +2,7 @@
// detail/descriptor_ops.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/descriptor_read_op.hpp b/boost/asio/detail/descriptor_read_op.hpp
index 328e2191c0..3ced62bb26 100644
--- a/boost/asio/detail/descriptor_read_op.hpp
+++ b/boost/asio/detail/descriptor_read_op.hpp
@@ -2,7 +2,7 @@
// detail/descriptor_read_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -67,20 +67,21 @@ private:
MutableBufferSequence buffers_;
};
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class descriptor_read_op
: public descriptor_read_op_base<MutableBufferSequence>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op);
- descriptor_read_op(int descriptor,
- const MutableBufferSequence& buffers, Handler& handler)
+ descriptor_read_op(int descriptor, const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: descriptor_read_op_base<MutableBufferSequence>(
descriptor, buffers, &descriptor_read_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -90,7 +91,7 @@ public:
// Take ownership of the handler object.
descriptor_read_op* o(static_cast<descriptor_read_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -117,6 +118,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/descriptor_write_op.hpp b/boost/asio/detail/descriptor_write_op.hpp
index 80ddf37d37..d1eea52789 100644
--- a/boost/asio/detail/descriptor_write_op.hpp
+++ b/boost/asio/detail/descriptor_write_op.hpp
@@ -2,7 +2,7 @@
// detail/descriptor_write_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -67,20 +67,21 @@ private:
ConstBufferSequence buffers_;
};
-template <typename ConstBufferSequence, typename Handler>
+template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
class descriptor_write_op
: public descriptor_write_op_base<ConstBufferSequence>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op);
- descriptor_write_op(int descriptor,
- const ConstBufferSequence& buffers, Handler& handler)
+ descriptor_write_op(int descriptor, const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: descriptor_write_op_base<ConstBufferSequence>(
descriptor, buffers, &descriptor_write_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -90,7 +91,7 @@ public:
// Take ownership of the handler object.
descriptor_write_op* o(static_cast<descriptor_write_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -117,6 +118,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/dev_poll_reactor.hpp b/boost/asio/detail/dev_poll_reactor.hpp
index cb15a9671b..63a0c3058f 100644
--- a/boost/asio/detail/dev_poll_reactor.hpp
+++ b/boost/asio/detail/dev_poll_reactor.hpp
@@ -2,7 +2,7 @@
// detail/dev_poll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/epoll_reactor.hpp b/boost/asio/detail/epoll_reactor.hpp
index 31a7b3dff3..c361978853 100644
--- a/boost/asio/detail/epoll_reactor.hpp
+++ b/boost/asio/detail/epoll_reactor.hpp
@@ -2,7 +2,7 @@
// detail/epoll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/event.hpp b/boost/asio/detail/event.hpp
index 8cb097cb24..b55a204059 100644
--- a/boost/asio/detail/event.hpp
+++ b/boost/asio/detail/event.hpp
@@ -2,7 +2,7 @@
// detail/event.hpp
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/eventfd_select_interrupter.hpp b/boost/asio/detail/eventfd_select_interrupter.hpp
index 4871c971ed..0bcbcb96db 100644
--- a/boost/asio/detail/eventfd_select_interrupter.hpp
+++ b/boost/asio/detail/eventfd_select_interrupter.hpp
@@ -2,7 +2,7 @@
// detail/eventfd_select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/detail/executor_function.hpp b/boost/asio/detail/executor_function.hpp
new file mode 100644
index 0000000000..2b8fb40a12
--- /dev/null
+++ b/boost/asio/detail/executor_function.hpp
@@ -0,0 +1,106 @@
+//
+// detail/executor_function.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2019 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_EXECUTOR_FUNCTION_HPP
+#define BOOST_ASIO_DETAIL_EXECUTOR_FUNCTION_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/handler_alloc_helpers.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+class executor_function_base
+{
+public:
+ void complete()
+ {
+ func_(this, true);
+ }
+
+ void destroy()
+ {
+ func_(this, false);
+ }
+
+protected:
+ typedef void (*func_type)(executor_function_base*, bool);
+
+ executor_function_base(func_type func)
+ : func_(func)
+ {
+ }
+
+ // Prevents deletion through this type.
+ ~executor_function_base()
+ {
+ }
+
+private:
+ func_type func_;
+};
+
+template <typename Function, typename Alloc>
+class executor_function : public executor_function_base
+{
+public:
+ BOOST_ASIO_DEFINE_TAGGED_HANDLER_ALLOCATOR_PTR(
+ thread_info_base::executor_function_tag, executor_function);
+
+ template <typename F>
+ executor_function(BOOST_ASIO_MOVE_ARG(F) f, const Alloc& allocator)
+ : executor_function_base(&executor_function::do_complete),
+ function_(BOOST_ASIO_MOVE_CAST(F)(f)),
+ allocator_(allocator)
+ {
+ }
+
+ static void do_complete(executor_function_base* base, bool call)
+ {
+ // Take ownership of the function object.
+ executor_function* o(static_cast<executor_function*>(base));
+ Alloc allocator(o->allocator_);
+ ptr p = { detail::addressof(allocator), o, o };
+
+ // Make a copy of the function so that the memory can be deallocated before
+ // the upcall is made. Even if we're not about to make an upcall, a
+ // sub-object of the function may be the true owner of the memory
+ // associated with the function. Consequently, a local copy of the function
+ // is required to ensure that any owning sub-object remains valid until
+ // after we have deallocated the memory here.
+ Function function(BOOST_ASIO_MOVE_CAST(Function)(o->function_));
+ p.reset();
+
+ // Make the upcall if required.
+ if (call)
+ {
+ function();
+ }
+ }
+
+private:
+ Function function_;
+ Alloc allocator_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_EXECUTOR_FUNCTION_HPP
diff --git a/boost/asio/detail/executor_op.hpp b/boost/asio/detail/executor_op.hpp
index 1c8671abc8..b2581201f3 100644
--- a/boost/asio/detail/executor_op.hpp
+++ b/boost/asio/detail/executor_op.hpp
@@ -2,7 +2,7 @@
// detail/executor_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/fd_set_adapter.hpp b/boost/asio/detail/fd_set_adapter.hpp
index 26ba12665e..d502910a6f 100644
--- a/boost/asio/detail/fd_set_adapter.hpp
+++ b/boost/asio/detail/fd_set_adapter.hpp
@@ -2,7 +2,7 @@
// detail/fd_set_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/fenced_block.hpp b/boost/asio/detail/fenced_block.hpp
index e80ed4073c..479db6daa7 100644
--- a/boost/asio/detail/fenced_block.hpp
+++ b/boost/asio/detail/fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/functional.hpp b/boost/asio/detail/functional.hpp
index 23218bb5df..73f06ece21 100644
--- a/boost/asio/detail/functional.hpp
+++ b/boost/asio/detail/functional.hpp
@@ -2,7 +2,7 @@
// detail/functional.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/future.hpp b/boost/asio/detail/future.hpp
index 38cc7c1e83..67a0c1bde3 100644
--- a/boost/asio/detail/future.hpp
+++ b/boost/asio/detail/future.hpp
@@ -2,7 +2,7 @@
// detail/future.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/gcc_arm_fenced_block.hpp b/boost/asio/detail/gcc_arm_fenced_block.hpp
index 3a5a1dfacf..4051657ed7 100644
--- a/boost/asio/detail/gcc_arm_fenced_block.hpp
+++ b/boost/asio/detail/gcc_arm_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/gcc_arm_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/gcc_hppa_fenced_block.hpp b/boost/asio/detail/gcc_hppa_fenced_block.hpp
index bc0bc8afb4..a3061c0301 100644
--- a/boost/asio/detail/gcc_hppa_fenced_block.hpp
+++ b/boost/asio/detail/gcc_hppa_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/gcc_hppa_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/gcc_sync_fenced_block.hpp b/boost/asio/detail/gcc_sync_fenced_block.hpp
index e464738ee0..a167c52f75 100644
--- a/boost/asio/detail/gcc_sync_fenced_block.hpp
+++ b/boost/asio/detail/gcc_sync_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/gcc_sync_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/gcc_x86_fenced_block.hpp b/boost/asio/detail/gcc_x86_fenced_block.hpp
index f66289fe96..5d5e4eef4a 100644
--- a/boost/asio/detail/gcc_x86_fenced_block.hpp
+++ b/boost/asio/detail/gcc_x86_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/gcc_x86_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/global.hpp b/boost/asio/detail/global.hpp
index 967890408f..383ceb8cd8 100644
--- a/boost/asio/detail/global.hpp
+++ b/boost/asio/detail/global.hpp
@@ -2,7 +2,7 @@
// detail/global.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/handler_alloc_helpers.hpp b/boost/asio/detail/handler_alloc_helpers.hpp
index 6e72051393..85b825dd02 100644
--- a/boost/asio/detail/handler_alloc_helpers.hpp
+++ b/boost/asio/detail/handler_alloc_helpers.hpp
@@ -2,7 +2,7 @@
// detail/handler_alloc_helpers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -194,7 +194,7 @@ struct get_hook_allocator<Handler, std::allocator<T> >
} \
/**/
-#define BOOST_ASIO_DEFINE_HANDLER_ALLOCATOR_PTR(op) \
+#define BOOST_ASIO_DEFINE_TAGGED_HANDLER_ALLOCATOR_PTR(purpose, op) \
struct ptr \
{ \
const Alloc* a; \
@@ -207,9 +207,10 @@ struct get_hook_allocator<Handler, std::allocator<T> >
static op* allocate(const Alloc& a) \
{ \
typedef typename ::boost::asio::detail::get_recycling_allocator< \
- Alloc>::type recycling_allocator_type; \
+ Alloc, purpose>::type recycling_allocator_type; \
BOOST_ASIO_REBIND_ALLOC(recycling_allocator_type, op) a1( \
- ::boost::asio::detail::get_recycling_allocator<Alloc>::get(a)); \
+ ::boost::asio::detail::get_recycling_allocator< \
+ Alloc, purpose>::get(a)); \
return a1.allocate(1); \
} \
void reset() \
@@ -222,9 +223,10 @@ struct get_hook_allocator<Handler, std::allocator<T> >
if (v) \
{ \
typedef typename ::boost::asio::detail::get_recycling_allocator< \
- Alloc>::type recycling_allocator_type; \
+ Alloc, purpose>::type recycling_allocator_type; \
BOOST_ASIO_REBIND_ALLOC(recycling_allocator_type, op) a1( \
- ::boost::asio::detail::get_recycling_allocator<Alloc>::get(*a)); \
+ ::boost::asio::detail::get_recycling_allocator< \
+ Alloc, purpose>::get(*a)); \
a1.deallocate(static_cast<op*>(v), 1); \
v = 0; \
} \
@@ -232,6 +234,11 @@ struct get_hook_allocator<Handler, std::allocator<T> >
} \
/**/
+#define BOOST_ASIO_DEFINE_HANDLER_ALLOCATOR_PTR(op) \
+ BOOST_ASIO_DEFINE_TAGGED_HANDLER_ALLOCATOR_PTR( \
+ ::boost::asio::detail::thread_info_base::default_tag, op ) \
+ /**/
+
#include <boost/asio/detail/pop_options.hpp>
#endif // BOOST_ASIO_DETAIL_HANDLER_ALLOC_HELPERS_HPP
diff --git a/boost/asio/detail/handler_cont_helpers.hpp b/boost/asio/detail/handler_cont_helpers.hpp
index 700505d579..204097e032 100644
--- a/boost/asio/detail/handler_cont_helpers.hpp
+++ b/boost/asio/detail/handler_cont_helpers.hpp
@@ -2,7 +2,7 @@
// detail/handler_cont_helpers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/handler_invoke_helpers.hpp b/boost/asio/detail/handler_invoke_helpers.hpp
index 8ced5f617c..e453b02cf4 100644
--- a/boost/asio/detail/handler_invoke_helpers.hpp
+++ b/boost/asio/detail/handler_invoke_helpers.hpp
@@ -2,7 +2,7 @@
// detail/handler_invoke_helpers.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/handler_tracking.hpp b/boost/asio/detail/handler_tracking.hpp
index 0839e09159..35eff023e2 100644
--- a/boost/asio/detail/handler_tracking.hpp
+++ b/boost/asio/detail/handler_tracking.hpp
@@ -2,7 +2,7 @@
// detail/handler_tracking.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/handler_type_requirements.hpp b/boost/asio/detail/handler_type_requirements.hpp
index 3a83c8d154..cf57d67652 100644
--- a/boost/asio/detail/handler_type_requirements.hpp
+++ b/boost/asio/detail/handler_type_requirements.hpp
@@ -2,7 +2,7 @@
// detail/handler_type_requirements.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/handler_work.hpp b/boost/asio/detail/handler_work.hpp
index dbd1bb911a..06da376178 100644
--- a/boost/asio/detail/handler_work.hpp
+++ b/boost/asio/detail/handler_work.hpp
@@ -2,7 +2,7 @@
// detail/handler_work.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,24 +28,41 @@ namespace detail {
// A helper class template to allow completion handlers to be dispatched
// through either the new executors framework or the old invocaton hook. The
// primary template uses the new executors framework.
-template <typename Handler, typename Executor
- = typename associated_executor<Handler>::type>
+template <typename Handler,
+ typename IoExecutor = system_executor, typename HandlerExecutor
+ = typename associated_executor<Handler, IoExecutor>::type>
class handler_work
{
public:
explicit handler_work(Handler& handler) BOOST_ASIO_NOEXCEPT
- : executor_(associated_executor<Handler>::get(handler))
+ : io_executor_(),
+ executor_(boost::asio::get_associated_executor(handler, io_executor_))
+ {
+ }
+
+ handler_work(Handler& handler, const IoExecutor& io_ex) BOOST_ASIO_NOEXCEPT
+ : io_executor_(io_ex),
+ executor_(boost::asio::get_associated_executor(handler, io_executor_))
{
}
static void start(Handler& handler) BOOST_ASIO_NOEXCEPT
{
- Executor ex(associated_executor<Handler>::get(handler));
+ HandlerExecutor ex(boost::asio::get_associated_executor(handler));
+ ex.on_work_started();
+ }
+
+ static void start(Handler& handler,
+ const IoExecutor& io_ex) BOOST_ASIO_NOEXCEPT
+ {
+ HandlerExecutor ex(boost::asio::get_associated_executor(handler, io_ex));
ex.on_work_started();
+ io_ex.on_work_started();
}
~handler_work()
{
+ io_executor_.on_work_finished();
executor_.on_work_finished();
}
@@ -53,7 +70,7 @@ public:
void complete(Function& function, Handler& handler)
{
executor_.dispatch(BOOST_ASIO_MOVE_CAST(Function)(function),
- associated_allocator<Handler>::get(handler));
+ boost::asio::get_associated_allocator(handler));
}
private:
@@ -61,7 +78,8 @@ private:
handler_work(const handler_work&);
handler_work& operator=(const handler_work&);
- typename associated_executor<Handler>::type executor_;
+ IoExecutor io_executor_;
+ HandlerExecutor executor_;
};
// This specialisation dispatches a handler through the old invocation hook.
@@ -69,7 +87,7 @@ private:
// system_executor will dispatch through the hook anyway. However, by doing
// this we avoid an extra copy of the handler.
template <typename Handler>
-class handler_work<Handler, system_executor>
+class handler_work<Handler, system_executor, system_executor>
{
public:
explicit handler_work(Handler&) BOOST_ASIO_NOEXCEPT {}
diff --git a/boost/asio/detail/hash_map.hpp b/boost/asio/detail/hash_map.hpp
index 6a13620e92..ac80abdc79 100644
--- a/boost/asio/detail/hash_map.hpp
+++ b/boost/asio/detail/hash_map.hpp
@@ -2,7 +2,7 @@
// detail/hash_map.hpp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/buffer_sequence_adapter.ipp b/boost/asio/detail/impl/buffer_sequence_adapter.ipp
index 26708ced33..b3fb59ccc7 100644
--- a/boost/asio/detail/impl/buffer_sequence_adapter.ipp
+++ b/boost/asio/detail/impl/buffer_sequence_adapter.ipp
@@ -2,7 +2,7 @@
// detail/impl/buffer_sequence_adapter.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/descriptor_ops.ipp b/boost/asio/detail/impl/descriptor_ops.ipp
index 1bb68be1c0..1a26e6db69 100644
--- a/boost/asio/detail/impl/descriptor_ops.ipp
+++ b/boost/asio/detail/impl/descriptor_ops.ipp
@@ -2,7 +2,7 @@
// detail/impl/descriptor_ops.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/dev_poll_reactor.hpp b/boost/asio/detail/impl/dev_poll_reactor.hpp
index 797937bad8..87dd20ab4b 100644
--- a/boost/asio/detail/impl/dev_poll_reactor.hpp
+++ b/boost/asio/detail/impl/dev_poll_reactor.hpp
@@ -2,7 +2,7 @@
// detail/impl/dev_poll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/dev_poll_reactor.ipp b/boost/asio/detail/impl/dev_poll_reactor.ipp
index 5cc73ca9c1..807741dc4d 100644
--- a/boost/asio/detail/impl/dev_poll_reactor.ipp
+++ b/boost/asio/detail/impl/dev_poll_reactor.ipp
@@ -2,7 +2,7 @@
// detail/impl/dev_poll_reactor.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/epoll_reactor.hpp b/boost/asio/detail/impl/epoll_reactor.hpp
index 101b1d6ead..15968a30b3 100644
--- a/boost/asio/detail/impl/epoll_reactor.hpp
+++ b/boost/asio/detail/impl/epoll_reactor.hpp
@@ -2,7 +2,7 @@
// detail/impl/epoll_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/epoll_reactor.ipp b/boost/asio/detail/impl/epoll_reactor.ipp
index 1e9babcc14..b1e1b39d05 100644
--- a/boost/asio/detail/impl/epoll_reactor.ipp
+++ b/boost/asio/detail/impl/epoll_reactor.ipp
@@ -2,7 +2,7 @@
// detail/impl/epoll_reactor.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/boost/asio/detail/impl/eventfd_select_interrupter.ipp
index 8804009442..38d4b2a61d 100644
--- a/boost/asio/detail/impl/eventfd_select_interrupter.ipp
+++ b/boost/asio/detail/impl/eventfd_select_interrupter.ipp
@@ -2,7 +2,7 @@
// detail/impl/eventfd_select_interrupter.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/detail/impl/handler_tracking.ipp b/boost/asio/detail/impl/handler_tracking.ipp
index b3abbb513a..c873a50987 100644
--- a/boost/asio/detail/impl/handler_tracking.ipp
+++ b/boost/asio/detail/impl/handler_tracking.ipp
@@ -2,7 +2,7 @@
// detail/impl/handler_tracking.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/kqueue_reactor.hpp b/boost/asio/detail/impl/kqueue_reactor.hpp
index 4d79ba5d7c..f4dd174fdc 100644
--- a/boost/asio/detail/impl/kqueue_reactor.hpp
+++ b/boost/asio/detail/impl/kqueue_reactor.hpp
@@ -2,7 +2,7 @@
// detail/impl/kqueue_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/detail/impl/kqueue_reactor.ipp b/boost/asio/detail/impl/kqueue_reactor.ipp
index 9069ae4442..02475aaa36 100644
--- a/boost/asio/detail/impl/kqueue_reactor.ipp
+++ b/boost/asio/detail/impl/kqueue_reactor.ipp
@@ -2,7 +2,7 @@
// detail/impl/kqueue_reactor.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/detail/impl/null_event.ipp b/boost/asio/detail/impl/null_event.ipp
index 19bab80b33..b7568413fb 100644
--- a/boost/asio/detail/impl/null_event.ipp
+++ b/boost/asio/detail/impl/null_event.ipp
@@ -2,7 +2,7 @@
// detail/impl/null_event.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/pipe_select_interrupter.ipp b/boost/asio/detail/impl/pipe_select_interrupter.ipp
index bfff076747..f7bb7851b2 100644
--- a/boost/asio/detail/impl/pipe_select_interrupter.ipp
+++ b/boost/asio/detail/impl/pipe_select_interrupter.ipp
@@ -2,7 +2,7 @@
// detail/impl/pipe_select_interrupter.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/posix_event.ipp b/boost/asio/detail/impl/posix_event.ipp
index 6f096bc08e..1c6d885a63 100644
--- a/boost/asio/detail/impl/posix_event.ipp
+++ b/boost/asio/detail/impl/posix_event.ipp
@@ -2,7 +2,7 @@
// detail/impl/posix_event.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/posix_mutex.ipp b/boost/asio/detail/impl/posix_mutex.ipp
index 57564714a1..fc86d43815 100644
--- a/boost/asio/detail/impl/posix_mutex.ipp
+++ b/boost/asio/detail/impl/posix_mutex.ipp
@@ -2,7 +2,7 @@
// detail/impl/posix_mutex.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/posix_thread.ipp b/boost/asio/detail/impl/posix_thread.ipp
index c2ee8efef7..d01922c625 100644
--- a/boost/asio/detail/impl/posix_thread.ipp
+++ b/boost/asio/detail/impl/posix_thread.ipp
@@ -2,7 +2,7 @@
// detail/impl/posix_thread.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/posix_tss_ptr.ipp b/boost/asio/detail/impl/posix_tss_ptr.ipp
index a40f3f81a6..623dc679c5 100644
--- a/boost/asio/detail/impl/posix_tss_ptr.ipp
+++ b/boost/asio/detail/impl/posix_tss_ptr.ipp
@@ -2,7 +2,7 @@
// detail/impl/posix_tss_ptr.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/reactive_descriptor_service.ipp b/boost/asio/detail/impl/reactive_descriptor_service.ipp
index 735239c597..0611a953db 100644
--- a/boost/asio/detail/impl/reactive_descriptor_service.ipp
+++ b/boost/asio/detail/impl/reactive_descriptor_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/reactive_descriptor_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -31,9 +31,9 @@ namespace asio {
namespace detail {
reactive_descriptor_service::reactive_descriptor_service(
- boost::asio::io_context& io_context)
- : service_base<reactive_descriptor_service>(io_context),
- reactor_(boost::asio::use_service<reactor>(io_context))
+ execution_context& context)
+ : execution_context_service_base<reactive_descriptor_service>(context),
+ reactor_(boost::asio::use_service<reactor>(context))
{
reactor_.init_task();
}
diff --git a/boost/asio/detail/impl/reactive_serial_port_service.ipp b/boost/asio/detail/impl/reactive_serial_port_service.ipp
index c1ff461830..62546604b4 100644
--- a/boost/asio/detail/impl/reactive_serial_port_service.ipp
+++ b/boost/asio/detail/impl/reactive_serial_port_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/reactive_serial_port_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -31,9 +31,9 @@ namespace asio {
namespace detail {
reactive_serial_port_service::reactive_serial_port_service(
- boost::asio::io_context& io_context)
- : service_base<reactive_serial_port_service>(io_context),
- descriptor_service_(io_context)
+ execution_context& context)
+ : execution_context_service_base<reactive_serial_port_service>(context),
+ descriptor_service_(context)
{
}
diff --git a/boost/asio/detail/impl/reactive_socket_service_base.ipp b/boost/asio/detail/impl/reactive_socket_service_base.ipp
index 6fdf437c1d..5ae4b64a6d 100644
--- a/boost/asio/detail/impl/reactive_socket_service_base.ipp
+++ b/boost/asio/detail/impl/reactive_socket_service_base.ipp
@@ -2,7 +2,7 @@
// detail/reactive_socket_service_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -29,9 +29,8 @@ namespace asio {
namespace detail {
reactive_socket_service_base::reactive_socket_service_base(
- boost::asio::io_context& io_context)
- : io_context_(io_context),
- reactor_(use_service<reactor>(io_context))
+ execution_context& context)
+ : reactor_(use_service<reactor>(context))
{
reactor_.init_task();
}
diff --git a/boost/asio/detail/impl/resolver_service_base.ipp b/boost/asio/detail/impl/resolver_service_base.ipp
index 144e2a1753..64b92a89ac 100644
--- a/boost/asio/detail/impl/resolver_service_base.ipp
+++ b/boost/asio/detail/impl/resolver_service_base.ipp
@@ -2,7 +2,7 @@
// detail/impl/resolver_service_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -24,25 +24,30 @@ namespace boost {
namespace asio {
namespace detail {
-class resolver_service_base::work_io_context_runner
+class resolver_service_base::work_scheduler_runner
{
public:
- work_io_context_runner(boost::asio::io_context& io_context)
- : io_context_(io_context) {}
- void operator()() { io_context_.run(); }
+ work_scheduler_runner(scheduler_impl& work_scheduler)
+ : work_scheduler_(work_scheduler)
+ {
+ }
+
+ void operator()()
+ {
+ boost::system::error_code ec;
+ work_scheduler_.run(ec);
+ }
+
private:
- boost::asio::io_context& io_context_;
+ scheduler_impl& work_scheduler_;
};
-resolver_service_base::resolver_service_base(
- boost::asio::io_context& io_context)
- : io_context_impl_(boost::asio::use_service<io_context_impl>(io_context)),
- work_io_context_(new boost::asio::io_context(-1)),
- work_io_context_impl_(boost::asio::use_service<
- io_context_impl>(*work_io_context_)),
- work_(boost::asio::make_work_guard(*work_io_context_)),
+resolver_service_base::resolver_service_base(execution_context& context)
+ : scheduler_(boost::asio::use_service<scheduler_impl>(context)),
+ work_scheduler_(new scheduler_impl(context, -1, false)),
work_thread_(0)
{
+ work_scheduler_->work_started();
}
resolver_service_base::~resolver_service_base()
@@ -52,34 +57,35 @@ resolver_service_base::~resolver_service_base()
void resolver_service_base::base_shutdown()
{
- work_.reset();
- if (work_io_context_.get())
+ if (work_scheduler_.get())
{
- work_io_context_->stop();
+ work_scheduler_->work_finished();
+ work_scheduler_->stop();
if (work_thread_.get())
{
work_thread_->join();
work_thread_.reset();
}
- work_io_context_.reset();
+ work_scheduler_.reset();
}
}
void resolver_service_base::base_notify_fork(
- boost::asio::io_context::fork_event fork_ev)
+ execution_context::fork_event fork_ev)
{
if (work_thread_.get())
{
- if (fork_ev == boost::asio::io_context::fork_prepare)
+ if (fork_ev == execution_context::fork_prepare)
{
- work_io_context_->stop();
+ work_scheduler_->stop();
work_thread_->join();
+ work_thread_.reset();
}
else
{
- work_io_context_->restart();
+ work_scheduler_->restart();
work_thread_.reset(new boost::asio::detail::thread(
- work_io_context_runner(*work_io_context_)));
+ work_scheduler_runner(*work_scheduler_)));
}
}
}
@@ -93,7 +99,7 @@ void resolver_service_base::construct(
void resolver_service_base::destroy(
resolver_service_base::implementation_type& impl)
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_impl_.context(),
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(),
"resolver", &impl, 0, "cancel"));
impl.reset();
@@ -115,7 +121,7 @@ void resolver_service_base::move_assign(implementation_type& impl,
void resolver_service_base::cancel(
resolver_service_base::implementation_type& impl)
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_impl_.context(),
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(),
"resolver", &impl, 0, "cancel"));
impl.reset(static_cast<void*>(0), socket_ops::noop_deleter());
@@ -124,16 +130,16 @@ void resolver_service_base::cancel(
void resolver_service_base::start_resolve_op(resolve_op* op)
{
if (BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(SCHEDULER,
- io_context_impl_.concurrency_hint()))
+ scheduler_.concurrency_hint()))
{
start_work_thread();
- io_context_impl_.work_started();
- work_io_context_impl_.post_immediate_completion(op, false);
+ scheduler_.work_started();
+ work_scheduler_->post_immediate_completion(op, false);
}
else
{
op->ec_ = boost::asio::error::operation_not_supported;
- io_context_impl_.post_immediate_completion(op, false);
+ scheduler_.post_immediate_completion(op, false);
}
}
@@ -143,7 +149,7 @@ void resolver_service_base::start_work_thread()
if (!work_thread_.get())
{
work_thread_.reset(new boost::asio::detail::thread(
- work_io_context_runner(*work_io_context_)));
+ work_scheduler_runner(*work_scheduler_)));
}
}
diff --git a/boost/asio/detail/impl/scheduler.ipp b/boost/asio/detail/impl/scheduler.ipp
index 9dae6836ce..4ef5c86688 100644
--- a/boost/asio/detail/impl/scheduler.ipp
+++ b/boost/asio/detail/impl/scheduler.ipp
@@ -2,7 +2,7 @@
// detail/impl/scheduler.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -23,6 +23,7 @@
#include <boost/asio/detail/reactor.hpp>
#include <boost/asio/detail/scheduler.hpp>
#include <boost/asio/detail/scheduler_thread_info.hpp>
+#include <boost/asio/detail/signal_blocker.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -30,6 +31,24 @@ namespace boost {
namespace asio {
namespace detail {
+class scheduler::thread_function
+{
+public:
+ explicit thread_function(scheduler* s)
+ : this_(s)
+ {
+ }
+
+ void operator()()
+ {
+ boost::system::error_code ec;
+ this_->run(ec);
+ }
+
+private:
+ scheduler* this_;
+};
+
struct scheduler::task_cleanup
{
~task_cleanup()
@@ -85,8 +104,8 @@ struct scheduler::work_cleanup
thread_info* this_thread_;
};
-scheduler::scheduler(
- boost::asio::execution_context& ctx, int concurrency_hint)
+scheduler::scheduler(boost::asio::execution_context& ctx,
+ int concurrency_hint, bool own_thread)
: boost::asio::detail::execution_context_service_base<scheduler>(ctx),
one_thread_(concurrency_hint == 1
|| !BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(
@@ -100,17 +119,44 @@ scheduler::scheduler(
outstanding_work_(0),
stopped_(false),
shutdown_(false),
- concurrency_hint_(concurrency_hint)
+ concurrency_hint_(concurrency_hint),
+ thread_(0)
{
BOOST_ASIO_HANDLER_TRACKING_INIT;
+
+ if (own_thread)
+ {
+ ++outstanding_work_;
+ boost::asio::detail::signal_blocker sb;
+ thread_ = new boost::asio::detail::thread(thread_function(this));
+ }
+}
+
+scheduler::~scheduler()
+{
+ if (thread_)
+ {
+ thread_->join();
+ delete thread_;
+ }
}
void scheduler::shutdown()
{
mutex::scoped_lock lock(mutex_);
shutdown_ = true;
+ if (thread_)
+ stop_all_threads(lock);
lock.unlock();
+ // Join thread to ensure task operation is returned to queue.
+ if (thread_)
+ {
+ thread_->join();
+ delete thread_;
+ thread_ = 0;
+ }
+
// Destroy handler objects.
while (!op_queue_.empty())
{
diff --git a/boost/asio/detail/impl/select_reactor.hpp b/boost/asio/detail/impl/select_reactor.hpp
index 0fbaeb9ced..c741492c6a 100644
--- a/boost/asio/detail/impl/select_reactor.hpp
+++ b/boost/asio/detail/impl/select_reactor.hpp
@@ -2,7 +2,7 @@
// detail/impl/select_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/select_reactor.ipp b/boost/asio/detail/impl/select_reactor.ipp
index 4f1f5a8303..34d3d9f031 100644
--- a/boost/asio/detail/impl/select_reactor.ipp
+++ b/boost/asio/detail/impl/select_reactor.ipp
@@ -2,7 +2,7 @@
// detail/impl/select_reactor.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/service_registry.hpp b/boost/asio/detail/impl/service_registry.hpp
index c50614410e..e18473c8c8 100644
--- a/boost/asio/detail/impl/service_registry.hpp
+++ b/boost/asio/detail/impl/service_registry.hpp
@@ -2,7 +2,7 @@
// detail/impl/service_registry.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/service_registry.ipp b/boost/asio/detail/impl/service_registry.ipp
index abdcd6a01a..da920fbc50 100644
--- a/boost/asio/detail/impl/service_registry.ipp
+++ b/boost/asio/detail/impl/service_registry.ipp
@@ -2,7 +2,7 @@
// detail/impl/service_registry.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/signal_set_service.ipp b/boost/asio/detail/impl/signal_set_service.ipp
index abd83b480c..5e23702bb0 100644
--- a/boost/asio/detail/impl/signal_set_service.ipp
+++ b/boost/asio/detail/impl/signal_set_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/signal_set_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -119,14 +119,13 @@ public:
// && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
// && !defined(__CYGWIN__)
-signal_set_service::signal_set_service(
- boost::asio::io_context& io_context)
- : service_base<signal_set_service>(io_context),
- io_context_(boost::asio::use_service<io_context_impl>(io_context)),
+signal_set_service::signal_set_service(execution_context& context)
+ : execution_context_service_base<signal_set_service>(context),
+ scheduler_(boost::asio::use_service<scheduler_impl>(context)),
#if !defined(BOOST_ASIO_WINDOWS) \
&& !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
&& !defined(__CYGWIN__)
- reactor_(boost::asio::use_service<reactor>(io_context)),
+ reactor_(boost::asio::use_service<reactor>(context)),
#endif // !defined(BOOST_ASIO_WINDOWS)
// && !defined(BOOST_ASIO_WINDOWS_RUNTIME)
// && !defined(__CYGWIN__)
@@ -170,11 +169,10 @@ void signal_set_service::shutdown()
}
}
- io_context_.abandon_operations(ops);
+ scheduler_.abandon_operations(ops);
}
-void signal_set_service::notify_fork(
- boost::asio::io_context::fork_event fork_ev)
+void signal_set_service::notify_fork(execution_context::fork_event fork_ev)
{
#if !defined(BOOST_ASIO_WINDOWS) \
&& !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
@@ -184,7 +182,7 @@ void signal_set_service::notify_fork(
switch (fork_ev)
{
- case boost::asio::io_context::fork_prepare:
+ case execution_context::fork_prepare:
{
int read_descriptor = state->read_descriptor_;
state->fork_prepared_ = true;
@@ -193,7 +191,7 @@ void signal_set_service::notify_fork(
reactor_.cleanup_descriptor_data(reactor_data_);
}
break;
- case boost::asio::io_context::fork_parent:
+ case execution_context::fork_parent:
if (state->fork_prepared_)
{
int read_descriptor = state->read_descriptor_;
@@ -203,7 +201,7 @@ void signal_set_service::notify_fork(
read_descriptor, reactor_data_, new pipe_read_op);
}
break;
- case boost::asio::io_context::fork_child:
+ case execution_context::fork_child:
if (state->fork_prepared_)
{
boost::asio::detail::signal_blocker blocker;
@@ -442,7 +440,7 @@ boost::system::error_code signal_set_service::cancel(
signal_set_service::implementation_type& impl,
boost::system::error_code& ec)
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(),
"signal_set", &impl, 0, "cancel"));
op_queue<operation> ops;
@@ -458,7 +456,7 @@ boost::system::error_code signal_set_service::cancel(
}
}
- io_context_.post_deferred_completions(ops);
+ scheduler_.post_deferred_completions(ops);
ec = boost::system::error_code();
return ec;
@@ -494,7 +492,7 @@ void signal_set_service::deliver_signal(int signal_number)
reg = reg->next_in_table_;
}
- service->io_context_.post_deferred_completions(ops);
+ service->scheduler_.post_deferred_completions(ops);
service = service->next_;
}
@@ -511,17 +509,17 @@ void signal_set_service::add_service(signal_set_service* service)
open_descriptors();
#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
- // If an io_context object is thread-unsafe then it must be the only
- // io_context used to create signal_set objects.
+ // If a scheduler_ object is thread-unsafe then it must be the only
+ // scheduler used to create signal_set objects.
if (state->service_list_ != 0)
{
if (!BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(SCHEDULER,
- service->io_context_.concurrency_hint())
+ service->scheduler_.concurrency_hint())
|| !BOOST_ASIO_CONCURRENCY_HINT_IS_LOCKING(SCHEDULER,
- state->service_list_->io_context_.concurrency_hint()))
+ state->service_list_->scheduler_.concurrency_hint()))
{
std::logic_error ex(
- "Thread-unsafe io_context objects require "
+ "Thread-unsafe execution context objects require "
"exclusive access to signal handling.");
boost::asio::detail::throw_exception(ex);
}
@@ -640,7 +638,7 @@ void signal_set_service::close_descriptors()
void signal_set_service::start_wait_op(
signal_set_service::implementation_type& impl, signal_op* op)
{
- io_context_.work_started();
+ scheduler_.work_started();
signal_state* state = get_signal_state();
static_mutex::scoped_lock lock(state->mutex_);
@@ -652,7 +650,7 @@ void signal_set_service::start_wait_op(
{
--reg->undelivered_;
op->signal_number_ = reg->signal_number_;
- io_context_.post_deferred_completion(op);
+ scheduler_.post_deferred_completion(op);
return;
}
diff --git a/boost/asio/detail/impl/socket_ops.ipp b/boost/asio/detail/impl/socket_ops.ipp
index bb60df0a8e..7d7c31fe03 100644
--- a/boost/asio/detail/impl/socket_ops.ipp
+++ b/boost/asio/detail/impl/socket_ops.ipp
@@ -2,7 +2,7 @@
// detail/impl/socket_ops.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -772,7 +772,7 @@ signed_size_type recv(socket_type s, buf* bufs, size_t count,
else if (ec.value() == ERROR_PORT_UNREACHABLE)
ec = boost::asio::error::connection_refused;
else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
- ec.assign(0, ec.category());
+ result = 0;
if (result != 0)
return socket_error_retval;
ec = boost::system::error_code();
@@ -926,7 +926,7 @@ signed_size_type recvfrom(socket_type s, buf* bufs, size_t count,
else if (ec.value() == ERROR_PORT_UNREACHABLE)
ec = boost::asio::error::connection_refused;
else if (ec.value() == WSAEMSGSIZE || ec.value() == ERROR_MORE_DATA)
- ec.assign(0, ec.category());
+ result = 0;
if (result != 0)
return socket_error_retval;
ec = boost::system::error_code();
@@ -1503,7 +1503,8 @@ int setsockopt(socket_type s, state_type& state, int level, int optname,
ec = boost::system::error_code();
#if defined(__MACH__) && defined(__APPLE__) \
- || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+ || defined(__NetBSD__) || defined(__FreeBSD__) \
+ || defined(__OpenBSD__) || defined(__QNX__)
// To implement portable behaviour for SO_REUSEADDR with UDP sockets we
// need to also set SO_REUSEPORT on BSD-based platforms.
if ((state & datagram_oriented)
diff --git a/boost/asio/detail/impl/socket_select_interrupter.ipp b/boost/asio/detail/impl/socket_select_interrupter.ipp
index 3d9e5289d3..e09c5fbeb0 100644
--- a/boost/asio/detail/impl/socket_select_interrupter.ipp
+++ b/boost/asio/detail/impl/socket_select_interrupter.ipp
@@ -2,7 +2,7 @@
// detail/impl/socket_select_interrupter.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/strand_executor_service.hpp b/boost/asio/detail/impl/strand_executor_service.hpp
index 6452b949f4..67eb8361dd 100644
--- a/boost/asio/detail/impl/strand_executor_service.hpp
+++ b/boost/asio/detail/impl/strand_executor_service.hpp
@@ -2,7 +2,7 @@
// detail/impl/strand_executor_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/strand_executor_service.ipp b/boost/asio/detail/impl/strand_executor_service.ipp
index aed4d3cf6a..60681ea2f2 100644
--- a/boost/asio/detail/impl/strand_executor_service.ipp
+++ b/boost/asio/detail/impl/strand_executor_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/strand_executor_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/strand_service.hpp b/boost/asio/detail/impl/strand_service.hpp
index d47708bb98..7e82876ea2 100644
--- a/boost/asio/detail/impl/strand_service.hpp
+++ b/boost/asio/detail/impl/strand_service.hpp
@@ -2,7 +2,7 @@
// detail/impl/strand_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/strand_service.ipp b/boost/asio/detail/impl/strand_service.ipp
index 9926f9abf3..340f310bf6 100644
--- a/boost/asio/detail/impl/strand_service.ipp
+++ b/boost/asio/detail/impl/strand_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/strand_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/throw_error.ipp b/boost/asio/detail/impl/throw_error.ipp
index ffcacf47ae..9483bd0f59 100644
--- a/boost/asio/detail/impl/throw_error.ipp
+++ b/boost/asio/detail/impl/throw_error.ipp
@@ -2,7 +2,7 @@
// detail/impl/throw_error.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/timer_queue_ptime.ipp b/boost/asio/detail/impl/timer_queue_ptime.ipp
index 8a6d5af815..2566c9c2ca 100644
--- a/boost/asio/detail/impl/timer_queue_ptime.ipp
+++ b/boost/asio/detail/impl/timer_queue_ptime.ipp
@@ -2,7 +2,7 @@
// detail/impl/timer_queue_ptime.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/timer_queue_set.ipp b/boost/asio/detail/impl/timer_queue_set.ipp
index 71f83216aa..b738142f28 100644
--- a/boost/asio/detail/impl/timer_queue_set.ipp
+++ b/boost/asio/detail/impl/timer_queue_set.ipp
@@ -2,7 +2,7 @@
// detail/impl/timer_queue_set.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_event.ipp b/boost/asio/detail/impl/win_event.ipp
index 3e7dfdcf21..c6e1e3582f 100644
--- a/boost/asio/detail/impl/win_event.ipp
+++ b/boost/asio/detail/impl/win_event.ipp
@@ -2,7 +2,7 @@
// detail/win_event.ipp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_iocp_handle_service.ipp b/boost/asio/detail/impl/win_iocp_handle_service.ipp
index 0cd7dd1719..1256c358ac 100644
--- a/boost/asio/detail/impl/win_iocp_handle_service.ipp
+++ b/boost/asio/detail/impl/win_iocp_handle_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_iocp_handle_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -66,10 +66,9 @@ public:
}
};
-win_iocp_handle_service::win_iocp_handle_service(
- boost::asio::io_context& io_context)
- : service_base<win_iocp_handle_service>(io_context),
- iocp_service_(boost::asio::use_service<win_iocp_io_context>(io_context)),
+win_iocp_handle_service::win_iocp_handle_service(execution_context& context)
+ : execution_context_service_base<win_iocp_handle_service>(context),
+ iocp_service_(boost::asio::use_service<win_iocp_io_context>(context)),
mutex_(),
impl_list_(0)
{
diff --git a/boost/asio/detail/impl/win_iocp_io_context.hpp b/boost/asio/detail/impl/win_iocp_io_context.hpp
index 771c1f3c3a..830a07dcd9 100644
--- a/boost/asio/detail/impl/win_iocp_io_context.hpp
+++ b/boost/asio/detail/impl/win_iocp_io_context.hpp
@@ -2,7 +2,7 @@
// detail/impl/win_iocp_io_context.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_iocp_io_context.ipp b/boost/asio/detail/impl/win_iocp_io_context.ipp
index 87637f0b5c..5bdc540972 100644
--- a/boost/asio/detail/impl/win_iocp_io_context.ipp
+++ b/boost/asio/detail/impl/win_iocp_io_context.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_iocp_io_context.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -24,6 +24,7 @@
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/handler_invoke_helpers.hpp>
#include <boost/asio/detail/limits.hpp>
+#include <boost/asio/detail/thread.hpp>
#include <boost/asio/detail/throw_error.hpp>
#include <boost/asio/detail/win_iocp_io_context.hpp>
@@ -33,6 +34,22 @@ namespace boost {
namespace asio {
namespace detail {
+struct win_iocp_io_context::thread_function
+{
+ explicit thread_function(win_iocp_io_context* s)
+ : this_(s)
+ {
+ }
+
+ void operator()()
+ {
+ boost::system::error_code ec;
+ this_->run(ec);
+ }
+
+ win_iocp_io_context* this_;
+};
+
struct win_iocp_io_context::work_finished_on_block_exit
{
~work_finished_on_block_exit()
@@ -63,7 +80,7 @@ struct win_iocp_io_context::timer_thread_function
};
win_iocp_io_context::win_iocp_io_context(
- boost::asio::execution_context& ctx, int concurrency_hint)
+ boost::asio::execution_context& ctx, int concurrency_hint, bool own_thread)
: execution_context_service_base<win_iocp_io_context>(ctx),
iocp_(),
outstanding_work_(0),
@@ -85,6 +102,21 @@ win_iocp_io_context::win_iocp_io_context(
boost::asio::error::get_system_category());
boost::asio::detail::throw_error(ec, "iocp");
}
+
+ if (own_thread)
+ {
+ ::InterlockedIncrement(&outstanding_work_);
+ thread_.reset(new boost::asio::detail::thread(thread_function(this)));
+ }
+}
+
+win_iocp_io_context::~win_iocp_io_context()
+{
+ if (thread_.get())
+ {
+ thread_->join();
+ thread_.reset();
+ }
}
void win_iocp_io_context::shutdown()
@@ -98,6 +130,13 @@ void win_iocp_io_context::shutdown()
::SetWaitableTimer(waitable_timer_.handle, &timeout, 1, 0, 0, FALSE);
}
+ if (thread_.get())
+ {
+ thread_->join();
+ thread_.reset();
+ ::InterlockedDecrement(&outstanding_work_);
+ }
+
while (::InterlockedExchangeAdd(&outstanding_work_, 0) > 0)
{
op_queue<win_iocp_operation> ops;
diff --git a/boost/asio/detail/impl/win_iocp_serial_port_service.ipp b/boost/asio/detail/impl/win_iocp_serial_port_service.ipp
index 7dbf9353ee..4e30b0f678 100644
--- a/boost/asio/detail/impl/win_iocp_serial_port_service.ipp
+++ b/boost/asio/detail/impl/win_iocp_serial_port_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_iocp_serial_port_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -30,9 +30,9 @@ namespace asio {
namespace detail {
win_iocp_serial_port_service::win_iocp_serial_port_service(
- boost::asio::io_context& io_context)
- : service_base<win_iocp_serial_port_service>(io_context),
- handle_service_(io_context)
+ execution_context& context)
+ : execution_context_service_base<win_iocp_serial_port_service>(context),
+ handle_service_(context)
{
}
diff --git a/boost/asio/detail/impl/win_iocp_socket_service_base.ipp b/boost/asio/detail/impl/win_iocp_socket_service_base.ipp
index 3b7e7066f5..f95c74ff58 100644
--- a/boost/asio/detail/impl/win_iocp_socket_service_base.ipp
+++ b/boost/asio/detail/impl/win_iocp_socket_service_base.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_iocp_socket_service_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,9 +28,9 @@ namespace asio {
namespace detail {
win_iocp_socket_service_base::win_iocp_socket_service_base(
- boost::asio::io_context& io_context)
- : io_context_(io_context),
- iocp_service_(use_service<win_iocp_io_context>(io_context)),
+ execution_context& context)
+ : context_(context),
+ iocp_service_(use_service<win_iocp_io_context>(context)),
reactor_(0),
connect_ex_(0),
nt_set_info_(0),
@@ -708,7 +708,7 @@ select_reactor& win_iocp_socket_service_base::get_reactor()
reinterpret_cast<void**>(&reactor_), 0, 0));
if (!r)
{
- r = &(use_service<select_reactor>(io_context_));
+ r = &(use_service<select_reactor>(context_));
interlocked_exchange_pointer(reinterpret_cast<void**>(&reactor_), r);
}
return *r;
diff --git a/boost/asio/detail/impl/win_mutex.ipp b/boost/asio/detail/impl/win_mutex.ipp
index 12922263f2..809d40f159 100644
--- a/boost/asio/detail/impl/win_mutex.ipp
+++ b/boost/asio/detail/impl/win_mutex.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_mutex.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_object_handle_service.ipp b/boost/asio/detail/impl/win_object_handle_service.ipp
index db56f722f2..f356a00613 100644
--- a/boost/asio/detail/impl/win_object_handle_service.ipp
+++ b/boost/asio/detail/impl/win_object_handle_service.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_object_handle_service.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2011 Boris Schaeling (boris@highscore.de)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -28,10 +28,9 @@ namespace boost {
namespace asio {
namespace detail {
-win_object_handle_service::win_object_handle_service(
- boost::asio::io_context& io_context)
- : service_base<win_object_handle_service>(io_context),
- io_context_(boost::asio::use_service<io_context_impl>(io_context)),
+win_object_handle_service::win_object_handle_service(execution_context& context)
+ : execution_context_service_base<win_object_handle_service>(context),
+ scheduler_(boost::asio::use_service<scheduler_impl>(context)),
mutex_(),
impl_list_(0),
shutdown_(false)
@@ -53,7 +52,7 @@ void win_object_handle_service::shutdown()
lock.unlock();
- io_context_.abandon_operations(ops);
+ scheduler_.abandon_operations(ops);
}
void win_object_handle_service::construct(
@@ -179,7 +178,7 @@ void win_object_handle_service::destroy(
if (is_open(impl))
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle",
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(), "object_handle",
&impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close"));
HANDLE wait_handle = impl.wait_handle_;
@@ -204,7 +203,7 @@ void win_object_handle_service::destroy(
::CloseHandle(impl.handle_);
impl.handle_ = INVALID_HANDLE_VALUE;
- io_context_.post_deferred_completions(ops);
+ scheduler_.post_deferred_completions(ops);
}
}
@@ -229,7 +228,7 @@ boost::system::error_code win_object_handle_service::close(
{
if (is_open(impl))
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle",
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(), "object_handle",
&impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "close"));
mutex::scoped_lock lock(mutex_);
@@ -265,7 +264,7 @@ boost::system::error_code win_object_handle_service::close(
boost::asio::error::get_system_category());
}
- io_context_.post_deferred_completions(completed_ops);
+ scheduler_.post_deferred_completions(completed_ops);
}
else
{
@@ -281,7 +280,7 @@ boost::system::error_code win_object_handle_service::cancel(
{
if (is_open(impl))
{
- BOOST_ASIO_HANDLER_OPERATION((io_context_.context(), "object_handle",
+ BOOST_ASIO_HANDLER_OPERATION((scheduler_.context(), "object_handle",
&impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "cancel"));
mutex::scoped_lock lock(mutex_);
@@ -307,7 +306,7 @@ boost::system::error_code win_object_handle_service::cancel(
ec = boost::system::error_code();
- io_context_.post_deferred_completions(completed_ops);
+ scheduler_.post_deferred_completions(completed_ops);
}
else
{
@@ -341,7 +340,7 @@ void win_object_handle_service::wait(
void win_object_handle_service::start_wait_op(
win_object_handle_service::implementation_type& impl, wait_op* op)
{
- io_context_.work_started();
+ scheduler_.work_started();
if (is_open(impl))
{
@@ -359,13 +358,13 @@ void win_object_handle_service::start_wait_op(
else
{
lock.unlock();
- io_context_.post_deferred_completion(op);
+ scheduler_.post_deferred_completion(op);
}
}
else
{
op->ec_ = boost::asio::error::bad_descriptor;
- io_context_.post_deferred_completion(op);
+ scheduler_.post_deferred_completion(op);
}
}
@@ -392,7 +391,7 @@ void win_object_handle_service::register_wait_callback(
}
lock.unlock();
- io_context_.post_deferred_completions(completed_ops);
+ scheduler_.post_deferred_completions(completed_ops);
}
}
@@ -434,9 +433,9 @@ void win_object_handle_service::wait_callback(PVOID param, BOOLEAN)
}
}
- io_context_impl& ioc = impl->owner_->io_context_;
+ scheduler_impl& sched = impl->owner_->scheduler_;
lock.unlock();
- ioc.post_deferred_completions(completed_ops);
+ sched.post_deferred_completions(completed_ops);
}
}
diff --git a/boost/asio/detail/impl/win_static_mutex.ipp b/boost/asio/detail/impl/win_static_mutex.ipp
index 10e8622e37..ae53dbe105 100644
--- a/boost/asio/detail/impl/win_static_mutex.ipp
+++ b/boost/asio/detail/impl/win_static_mutex.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_static_mutex.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_thread.ipp b/boost/asio/detail/impl/win_thread.ipp
index 710c9b9f9b..13faa0753e 100644
--- a/boost/asio/detail/impl/win_thread.ipp
+++ b/boost/asio/detail/impl/win_thread.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_thread.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/win_tss_ptr.ipp b/boost/asio/detail/impl/win_tss_ptr.ipp
index 755d020703..8c6c5c60d7 100644
--- a/boost/asio/detail/impl/win_tss_ptr.ipp
+++ b/boost/asio/detail/impl/win_tss_ptr.ipp
@@ -2,7 +2,7 @@
// detail/impl/win_tss_ptr.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/impl/winrt_ssocket_service_base.ipp b/boost/asio/detail/impl/winrt_ssocket_service_base.ipp
index e6254aed93..1728281091 100644
--- a/boost/asio/detail/impl/winrt_ssocket_service_base.ipp
+++ b/boost/asio/detail/impl/winrt_ssocket_service_base.ipp
@@ -2,7 +2,7 @@
// detail/impl/winrt_ssocket_service_base.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -31,9 +31,9 @@ namespace asio {
namespace detail {
winrt_ssocket_service_base::winrt_ssocket_service_base(
- boost::asio::io_context& io_context)
- : io_context_(use_service<io_context_impl>(io_context)),
- async_manager_(use_service<winrt_async_manager>(io_context)),
+ execution_context& context)
+ : scheduler_(use_service<scheduler_impl>(context)),
+ async_manager_(use_service<winrt_async_manager>(context)),
mutex_(),
impl_list_(0)
{
@@ -399,7 +399,7 @@ void winrt_ssocket_service_base::start_connect_op(
if (!is_open(impl))
{
op->ec_ = boost::asio::error::bad_descriptor;
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -428,7 +428,7 @@ void winrt_ssocket_service_base::start_connect_op(
if (op->ec_)
{
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -443,7 +443,7 @@ void winrt_ssocket_service_base::start_connect_op(
{
op->ec_ = boost::system::error_code(
e->HResult, boost::system::system_category());
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
}
}
@@ -494,14 +494,14 @@ void winrt_ssocket_service_base::start_send_op(
if (flags)
{
op->ec_ = boost::asio::error::operation_not_supported;
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
if (!is_open(impl))
{
op->ec_ = boost::asio::error::bad_descriptor;
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -512,7 +512,7 @@ void winrt_ssocket_service_base::start_send_op(
if (bufs.all_empty())
{
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -523,7 +523,7 @@ void winrt_ssocket_service_base::start_send_op(
{
op->ec_ = boost::system::error_code(e->HResult,
boost::system::system_category());
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
}
}
@@ -585,14 +585,14 @@ void winrt_ssocket_service_base::start_receive_op(
if (flags)
{
op->ec_ = boost::asio::error::operation_not_supported;
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
if (!is_open(impl))
{
op->ec_ = boost::asio::error::bad_descriptor;
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -603,7 +603,7 @@ void winrt_ssocket_service_base::start_receive_op(
if (bufs.all_empty())
{
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
return;
}
@@ -616,7 +616,7 @@ void winrt_ssocket_service_base::start_receive_op(
{
op->ec_ = boost::system::error_code(e->HResult,
boost::system::system_category());
- io_context_.post_immediate_completion(op, is_continuation);
+ scheduler_.post_immediate_completion(op, is_continuation);
}
}
diff --git a/boost/asio/detail/impl/winrt_timer_scheduler.hpp b/boost/asio/detail/impl/winrt_timer_scheduler.hpp
index a475f66640..89ac7a123c 100644
--- a/boost/asio/detail/impl/winrt_timer_scheduler.hpp
+++ b/boost/asio/detail/impl/winrt_timer_scheduler.hpp
@@ -2,7 +2,7 @@
// detail/impl/winrt_timer_scheduler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -47,12 +47,12 @@ void winrt_timer_scheduler::schedule_timer(timer_queue<Time_Traits>& queue,
if (shutdown_)
{
- io_context_.post_immediate_completion(op, false);
+ scheduler_.post_immediate_completion(op, false);
return;
}
bool earliest = queue.enqueue_timer(time, timer, op);
- io_context_.work_started();
+ scheduler_.work_started();
if (earliest)
event_.signal(lock);
}
@@ -66,7 +66,7 @@ std::size_t winrt_timer_scheduler::cancel_timer(timer_queue<Time_Traits>& queue,
op_queue<operation> ops;
std::size_t n = queue.cancel_timer(timer, ops, max_cancelled);
lock.unlock();
- io_context_.post_deferred_completions(ops);
+ scheduler_.post_deferred_completions(ops);
return n;
}
diff --git a/boost/asio/detail/impl/winrt_timer_scheduler.ipp b/boost/asio/detail/impl/winrt_timer_scheduler.ipp
index c8b77349cd..48cb29c42e 100644
--- a/boost/asio/detail/impl/winrt_timer_scheduler.ipp
+++ b/boost/asio/detail/impl/winrt_timer_scheduler.ipp
@@ -2,7 +2,7 @@
// detail/impl/winrt_timer_scheduler.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,10 +28,9 @@ namespace boost {
namespace asio {
namespace detail {
-winrt_timer_scheduler::winrt_timer_scheduler(
- boost::asio::io_context& io_context)
- : boost::asio::detail::service_base<winrt_timer_scheduler>(io_context),
- io_context_(use_service<io_context_impl>(io_context)),
+winrt_timer_scheduler::winrt_timer_scheduler(execution_context& context)
+ : execution_context_service_base<winrt_timer_scheduler>(context),
+ scheduler_(use_service<scheduler_impl>(context)),
mutex_(),
event_(),
timer_queues_(),
@@ -65,10 +64,10 @@ void winrt_timer_scheduler::shutdown()
op_queue<operation> ops;
timer_queues_.get_all_timers(ops);
- io_context_.abandon_operations(ops);
+ scheduler_.abandon_operations(ops);
}
-void winrt_timer_scheduler::notify_fork(boost::asio::io_context::fork_event)
+void winrt_timer_scheduler::notify_fork(execution_context::fork_event)
{
}
@@ -90,7 +89,7 @@ void winrt_timer_scheduler::run_thread()
if (!ops.empty())
{
lock.unlock();
- io_context_.post_deferred_completions(ops);
+ scheduler_.post_deferred_completions(ops);
lock.lock();
}
}
diff --git a/boost/asio/detail/impl/winsock_init.ipp b/boost/asio/detail/impl/winsock_init.ipp
index 5d31a03b06..85b50df5d0 100644
--- a/boost/asio/detail/impl/winsock_init.ipp
+++ b/boost/asio/detail/impl/winsock_init.ipp
@@ -2,7 +2,7 @@
// detail/impl/winsock_init.ipp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/io_control.hpp b/boost/asio/detail/io_control.hpp
index 112b0ad751..4f091dba08 100644
--- a/boost/asio/detail/io_control.hpp
+++ b/boost/asio/detail/io_control.hpp
@@ -2,7 +2,7 @@
// detail/io_control.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/io_object_executor.hpp b/boost/asio/detail/io_object_executor.hpp
new file mode 100644
index 0000000000..70b026b476
--- /dev/null
+++ b/boost/asio/detail/io_object_executor.hpp
@@ -0,0 +1,162 @@
+//
+// io_object_executor.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2019 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_IO_OBJECT_EXECUTOR_HPP
+#define BOOST_ASIO_DETAIL_IO_OBJECT_EXECUTOR_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/handler_invoke_helpers.hpp>
+#include <boost/asio/detail/type_traits.hpp>
+#include <boost/asio/io_context.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+// Wrap the (potentially polymorphic) executor so that we can bypass it when
+// dispatching on a target executor that has a native I/O implementation.
+template <typename Executor>
+class io_object_executor
+{
+public:
+ io_object_executor(const Executor& ex,
+ bool native_implementation) BOOST_ASIO_NOEXCEPT
+ : executor_(ex),
+ has_native_impl_(native_implementation)
+ {
+ }
+
+ io_object_executor(const io_object_executor& other) BOOST_ASIO_NOEXCEPT
+ : executor_(other.executor_),
+ has_native_impl_(other.has_native_impl_)
+ {
+ }
+
+ template <typename Executor1>
+ io_object_executor(
+ const io_object_executor<Executor1>& other) BOOST_ASIO_NOEXCEPT
+ : executor_(other.inner_executor()),
+ has_native_impl_(other.has_native_implementation())
+ {
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ io_object_executor(io_object_executor&& other) BOOST_ASIO_NOEXCEPT
+ : executor_(BOOST_ASIO_MOVE_CAST(Executor)(other.executor_)),
+ has_native_impl_(other.has_native_impl_)
+ {
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ const Executor& inner_executor() const BOOST_ASIO_NOEXCEPT
+ {
+ return executor_;
+ }
+
+ bool has_native_implementation() const BOOST_ASIO_NOEXCEPT
+ {
+ return has_native_impl_;
+ }
+
+ execution_context& context() const BOOST_ASIO_NOEXCEPT
+ {
+ return executor_.context();
+ }
+
+ void on_work_started() const BOOST_ASIO_NOEXCEPT
+ {
+ if (is_same<Executor, io_context::executor_type>::value
+ || has_native_impl_)
+ {
+ // When using a native implementation, work is already counted by the
+ // execution context.
+ }
+ else
+ {
+ executor_.on_work_started();
+ }
+ }
+
+ void on_work_finished() const BOOST_ASIO_NOEXCEPT
+ {
+ if (is_same<Executor, io_context::executor_type>::value
+ || has_native_impl_)
+ {
+ // When using a native implementation, work is already counted by the
+ // execution context.
+ }
+ else
+ {
+ executor_.on_work_finished();
+ }
+ }
+
+ template <typename F, typename A>
+ void dispatch(BOOST_ASIO_MOVE_ARG(F) f, const A& a) const
+ {
+ if (is_same<Executor, io_context::executor_type>::value
+ || has_native_impl_)
+ {
+ // When using a native implementation, I/O completion handlers are
+ // already dispatched according to the execution context's executor's
+ // rules. We can call the function directly.
+ typename decay<F>::type function(BOOST_ASIO_MOVE_CAST(F)(f));
+ boost_asio_handler_invoke_helpers::invoke(function, function);
+ }
+ else
+ {
+ executor_.dispatch(BOOST_ASIO_MOVE_CAST(F)(f), a);
+ }
+ }
+
+ template <typename F, typename A>
+ void post(BOOST_ASIO_MOVE_ARG(F) f, const A& a) const
+ {
+ executor_.post(BOOST_ASIO_MOVE_CAST(F)(f), a);
+ }
+
+ template <typename F, typename A>
+ void defer(BOOST_ASIO_MOVE_ARG(F) f, const A& a) const
+ {
+ executor_.defer(BOOST_ASIO_MOVE_CAST(F)(f), a);
+ }
+
+ friend bool operator==(const io_object_executor& a,
+ const io_object_executor& b) BOOST_ASIO_NOEXCEPT
+ {
+ return a.executor_ == b.executor_
+ && a.has_native_impl_ == b.has_native_impl_;
+ }
+
+ friend bool operator!=(const io_object_executor& a,
+ const io_object_executor& b) BOOST_ASIO_NOEXCEPT
+ {
+ return a.executor_ != b.executor_
+ || a.has_native_impl_ != b.has_native_impl_;
+ }
+
+private:
+ Executor executor_;
+ const bool has_native_impl_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_IO_OBJECT_EXECUTOR_HPP
diff --git a/boost/asio/detail/io_object_impl.hpp b/boost/asio/detail/io_object_impl.hpp
new file mode 100644
index 0000000000..be1a5e2ac2
--- /dev/null
+++ b/boost/asio/detail/io_object_impl.hpp
@@ -0,0 +1,195 @@
+//
+// io_object_impl.hpp
+// ~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2019 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_IO_OBJECT_IMPL_HPP
+#define BOOST_ASIO_DETAIL_IO_OBJECT_IMPL_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <new>
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/io_object_executor.hpp>
+#include <boost/asio/detail/type_traits.hpp>
+#include <boost/asio/io_context.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+
+class executor;
+
+namespace detail {
+
+inline bool is_native_io_executor(const io_context::executor_type&)
+{
+ return true;
+}
+
+template <typename Executor>
+inline bool is_native_io_executor(const Executor&,
+ typename enable_if<!is_same<Executor, executor>::value>::type* = 0)
+{
+ return false;
+}
+
+template <typename Executor>
+inline bool is_native_io_executor(const Executor& ex,
+ typename enable_if<is_same<Executor, executor>::value>::type* = 0)
+{
+#if !defined (BOOST_ASIO_NO_TYPEID)
+ return ex.target_type() == typeid(io_context::executor_type);
+#else // !defined (BOOST_ASIO_NO_TYPEID)
+ return false;
+#endif // !defined (BOOST_ASIO_NO_TYPEID)
+}
+
+template <typename IoObjectService,
+ typename Executor = io_context::executor_type>
+class io_object_impl
+{
+public:
+ // The type of the service that will be used to provide I/O operations.
+ typedef IoObjectService service_type;
+
+ // The underlying implementation type of I/O object.
+ typedef typename service_type::implementation_type implementation_type;
+
+ // The type of the executor associated with the object.
+ typedef Executor executor_type;
+
+ // The type of executor to be used when implementing asynchronous operations.
+ typedef io_object_executor<Executor> implementation_executor_type;
+
+ // Construct an I/O object using an executor.
+ explicit io_object_impl(const executor_type& ex)
+ : service_(&boost::asio::use_service<IoObjectService>(ex.context())),
+ implementation_executor_(ex, (is_native_io_executor)(ex))
+ {
+ service_->construct(implementation_);
+ }
+
+ // Construct an I/O object using an execution context.
+ template <typename ExecutionContext>
+ explicit io_object_impl(ExecutionContext& context,
+ typename enable_if<is_convertible<
+ ExecutionContext&, execution_context&>::value>::type* = 0)
+ : service_(&boost::asio::use_service<IoObjectService>(context)),
+ implementation_executor_(context.get_executor(),
+ is_same<ExecutionContext, io_context>::value)
+ {
+ service_->construct(implementation_);
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ // Move-construct an I/O object.
+ io_object_impl(io_object_impl&& other)
+ : service_(&other.get_service()),
+ implementation_executor_(other.get_implementation_executor())
+ {
+ service_->move_construct(implementation_, other.implementation_);
+ }
+
+ // Perform a converting move-construction of an I/O object.
+ template <typename IoObjectService1, typename Executor1>
+ io_object_impl(io_object_impl<IoObjectService1, Executor1>&& other)
+ : service_(&boost::asio::use_service<IoObjectService>(
+ other.get_implementation_executor().context())),
+ implementation_executor_(other.get_implementation_executor())
+ {
+ service_->converting_move_construct(implementation_,
+ other.get_service(), other.get_implementation());
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // Destructor.
+ ~io_object_impl()
+ {
+ service_->destroy(implementation_);
+ }
+
+#if defined(BOOST_ASIO_HAS_MOVE)
+ // Move-assign an I/O object.
+ io_object_impl& operator=(io_object_impl&& other)
+ {
+ if (this != &other)
+ {
+ service_->move_assign(implementation_,
+ *other.service_, other.implementation_);
+ implementation_executor_.~implementation_executor_type();
+ new (&implementation_executor_) implementation_executor_type(
+ std::move(other.implementation_executor_));
+ service_ = other.service_;
+ }
+ return *this;
+ }
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+
+ // Get the executor associated with the object.
+ executor_type get_executor() BOOST_ASIO_NOEXCEPT
+ {
+ return implementation_executor_.inner_executor();
+ }
+
+ // Get the executor to be used when implementing asynchronous operations.
+ const implementation_executor_type& get_implementation_executor()
+ BOOST_ASIO_NOEXCEPT
+ {
+ return implementation_executor_;
+ }
+
+ // Get the service associated with the I/O object.
+ service_type& get_service()
+ {
+ return *service_;
+ }
+
+ // Get the service associated with the I/O object.
+ const service_type& get_service() const
+ {
+ return *service_;
+ }
+
+ // Get the underlying implementation of the I/O object.
+ implementation_type& get_implementation()
+ {
+ return implementation_;
+ }
+
+ // Get the underlying implementation of the I/O object.
+ const implementation_type& get_implementation() const
+ {
+ return implementation_;
+ }
+
+private:
+ // Disallow copying and copy assignment.
+ io_object_impl(const io_object_impl&);
+ io_object_impl& operator=(const io_object_impl&);
+
+ // The service associated with the I/O object.
+ service_type* service_;
+
+ // The underlying implementation of the I/O object.
+ implementation_type implementation_;
+
+ // The associated executor.
+ implementation_executor_type implementation_executor_;
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_IO_OBJECT_IMPL_HPP
diff --git a/boost/asio/detail/is_buffer_sequence.hpp b/boost/asio/detail/is_buffer_sequence.hpp
index a3fb9931d2..89b8df762d 100644
--- a/boost/asio/detail/is_buffer_sequence.hpp
+++ b/boost/asio/detail/is_buffer_sequence.hpp
@@ -2,7 +2,7 @@
// detail/is_buffer_sequence.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -39,6 +39,8 @@ struct buffer_sequence_memfns_base
void prepare();
void commit();
void consume();
+ void grow();
+ void shrink();
};
template <typename T>
@@ -157,6 +159,24 @@ char consume_memfn_helper(
void (buffer_sequence_memfns_base::*)(),
&buffer_sequence_memfns_derived<T>::consume>*);
+template <typename>
+char (&grow_memfn_helper(...))[2];
+
+template <typename T>
+char grow_memfn_helper(
+ buffer_sequence_memfns_check<
+ void (buffer_sequence_memfns_base::*)(),
+ &buffer_sequence_memfns_derived<T>::grow>*);
+
+template <typename>
+char (&shrink_memfn_helper(...))[2];
+
+template <typename T>
+char shrink_memfn_helper(
+ buffer_sequence_memfns_check<
+ void (buffer_sequence_memfns_base::*)(),
+ &buffer_sequence_memfns_derived<T>::shrink>*);
+
template <typename, typename>
char (&buffer_sequence_element_type_helper(...))[2];
@@ -234,7 +254,7 @@ struct is_buffer_sequence<const_buffer, mutable_buffer>
};
template <typename T>
-struct is_dynamic_buffer_class
+struct is_dynamic_buffer_class_v1
: integral_constant<bool,
sizeof(size_memfn_helper<T>(0)) != 1 &&
sizeof(max_size_memfn_helper<T>(0)) != 1 &&
@@ -249,9 +269,32 @@ struct is_dynamic_buffer_class
};
template <typename T>
-struct is_dynamic_buffer
+struct is_dynamic_buffer_v1
+ : conditional<is_class<T>::value,
+ is_dynamic_buffer_class_v1<T>,
+ false_type>::type
+{
+};
+
+template <typename T>
+struct is_dynamic_buffer_class_v2
+ : integral_constant<bool,
+ sizeof(size_memfn_helper<T>(0)) != 1 &&
+ sizeof(max_size_memfn_helper<T>(0)) != 1 &&
+ sizeof(capacity_memfn_helper<T>(0)) != 1 &&
+ sizeof(data_memfn_helper<T>(0)) != 1 &&
+ sizeof(consume_memfn_helper<T>(0)) != 1 &&
+ sizeof(grow_memfn_helper<T>(0)) != 1 &&
+ sizeof(shrink_memfn_helper<T>(0)) != 1 &&
+ sizeof(const_buffers_type_typedef_helper<T>(0)) == 1 &&
+ sizeof(mutable_buffers_type_typedef_helper<T>(0)) == 1>
+{
+};
+
+template <typename T>
+struct is_dynamic_buffer_v2
: conditional<is_class<T>::value,
- is_dynamic_buffer_class<T>,
+ is_dynamic_buffer_class_v2<T>,
false_type>::type
{
};
diff --git a/boost/asio/detail/is_executor.hpp b/boost/asio/detail/is_executor.hpp
index bc52ee87ce..ffcbb973f1 100644
--- a/boost/asio/detail/is_executor.hpp
+++ b/boost/asio/detail/is_executor.hpp
@@ -2,7 +2,7 @@
// detail/is_executor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/keyword_tss_ptr.hpp b/boost/asio/detail/keyword_tss_ptr.hpp
index 8451b17510..b8770040a9 100644
--- a/boost/asio/detail/keyword_tss_ptr.hpp
+++ b/boost/asio/detail/keyword_tss_ptr.hpp
@@ -2,7 +2,7 @@
// detail/keyword_tss_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/kqueue_reactor.hpp b/boost/asio/detail/kqueue_reactor.hpp
index 31d79ca6a4..a5de8fa901 100644
--- a/boost/asio/detail/kqueue_reactor.hpp
+++ b/boost/asio/detail/kqueue_reactor.hpp
@@ -2,7 +2,7 @@
// detail/kqueue_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2005 Stefan Arentz (stefan at soze dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
diff --git a/boost/asio/detail/local_free_on_block_exit.hpp b/boost/asio/detail/local_free_on_block_exit.hpp
index 0f1a84108c..bcf65bed14 100644
--- a/boost/asio/detail/local_free_on_block_exit.hpp
+++ b/boost/asio/detail/local_free_on_block_exit.hpp
@@ -2,7 +2,7 @@
// detail/local_free_on_block_exit.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/macos_fenced_block.hpp b/boost/asio/detail/macos_fenced_block.hpp
index 20196a78f6..639fc65a63 100644
--- a/boost/asio/detail/macos_fenced_block.hpp
+++ b/boost/asio/detail/macos_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/macos_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/memory.hpp b/boost/asio/detail/memory.hpp
index 21a68e456f..a18b4d9acc 100644
--- a/boost/asio/detail/memory.hpp
+++ b/boost/asio/detail/memory.hpp
@@ -2,7 +2,7 @@
// detail/memory.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/mutex.hpp b/boost/asio/detail/mutex.hpp
index 9fe4ad333e..e5e75263b5 100644
--- a/boost/asio/detail/mutex.hpp
+++ b/boost/asio/detail/mutex.hpp
@@ -2,7 +2,7 @@
// detail/mutex.hpp
// ~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/non_const_lvalue.hpp b/boost/asio/detail/non_const_lvalue.hpp
new file mode 100644
index 0000000000..28e2a52bbe
--- /dev/null
+++ b/boost/asio/detail/non_const_lvalue.hpp
@@ -0,0 +1,56 @@
+//
+// detail/non_const_lvalue.hpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2003-2019 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_NON_CONST_LVALUE_HPP
+#define BOOST_ASIO_DETAIL_NON_CONST_LVALUE_HPP
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
+
+#include <boost/asio/detail/config.hpp>
+#include <boost/asio/detail/type_traits.hpp>
+
+#include <boost/asio/detail/push_options.hpp>
+
+namespace boost {
+namespace asio {
+namespace detail {
+
+template <typename T>
+struct non_const_lvalue
+{
+#if defined(BOOST_ASIO_HAS_MOVE)
+ explicit non_const_lvalue(T& t)
+ : value(static_cast<typename conditional<
+ is_same<T, typename decay<T>::type>::value,
+ typename decay<T>::type&, T&&>::type>(t))
+ {
+ }
+
+ typename conditional<is_same<T, typename decay<T>::type>::value,
+ typename decay<T>::type&, typename decay<T>::type>::type value;
+#else // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION)
+ explicit non_const_lvalue(const typename decay<T>::type& t)
+ : value(t)
+ {
+ }
+
+ typename decay<T>::type value;
+#endif // defined(BOOST_ASIO_HAS_MOVE)
+};
+
+} // namespace detail
+} // namespace asio
+} // namespace boost
+
+#include <boost/asio/detail/pop_options.hpp>
+
+#endif // BOOST_ASIO_DETAIL_NON_CONST_LVALUE_HPP
diff --git a/boost/asio/detail/noncopyable.hpp b/boost/asio/detail/noncopyable.hpp
index 36b30c074d..77cc71cb4d 100644
--- a/boost/asio/detail/noncopyable.hpp
+++ b/boost/asio/detail/noncopyable.hpp
@@ -2,7 +2,7 @@
// detail/noncopyable.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_event.hpp b/boost/asio/detail/null_event.hpp
index 8394028e41..8ffc17c86c 100644
--- a/boost/asio/detail/null_event.hpp
+++ b/boost/asio/detail/null_event.hpp
@@ -2,7 +2,7 @@
// detail/null_event.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_fenced_block.hpp b/boost/asio/detail/null_fenced_block.hpp
index f9f59af3a9..8fadff6906 100644
--- a/boost/asio/detail/null_fenced_block.hpp
+++ b/boost/asio/detail/null_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/null_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_global.hpp b/boost/asio/detail/null_global.hpp
index 3a4d516889..12303c295b 100644
--- a/boost/asio/detail/null_global.hpp
+++ b/boost/asio/detail/null_global.hpp
@@ -2,7 +2,7 @@
// detail/null_global.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_mutex.hpp b/boost/asio/detail/null_mutex.hpp
index 90b92fe77b..7373675a03 100644
--- a/boost/asio/detail/null_mutex.hpp
+++ b/boost/asio/detail/null_mutex.hpp
@@ -2,7 +2,7 @@
// detail/null_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_reactor.hpp b/boost/asio/detail/null_reactor.hpp
index 028f0f3535..4552e1cd89 100644
--- a/boost/asio/detail/null_reactor.hpp
+++ b/boost/asio/detail/null_reactor.hpp
@@ -2,7 +2,7 @@
// detail/null_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_signal_blocker.hpp b/boost/asio/detail/null_signal_blocker.hpp
index b2285c1f45..74f5b75a54 100644
--- a/boost/asio/detail/null_signal_blocker.hpp
+++ b/boost/asio/detail/null_signal_blocker.hpp
@@ -2,7 +2,7 @@
// detail/null_signal_blocker.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_socket_service.hpp b/boost/asio/detail/null_socket_service.hpp
index 2c5b784125..552d993308 100644
--- a/boost/asio/detail/null_socket_service.hpp
+++ b/boost/asio/detail/null_socket_service.hpp
@@ -2,7 +2,7 @@
// detail/null_socket_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,7 +21,8 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+#include <boost/asio/post.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/bind_handler.hpp>
@@ -33,7 +34,7 @@ namespace detail {
template <typename Protocol>
class null_socket_service :
- public service_base<null_socket_service<Protocol> >
+ public execution_context_service_base<null_socket_service<Protocol> >
{
public:
// The protocol type.
@@ -51,9 +52,8 @@ public:
};
// Constructor.
- null_socket_service(boost::asio::io_context& io_context)
- : service_base<null_socket_service<Protocol> >(io_context),
- io_context_(io_context)
+ null_socket_service(execution_context& context)
+ : execution_context_service_base<null_socket_service<Protocol> >(context)
{
}
@@ -273,23 +273,25 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send(implementation_type&, const ConstBufferSequence&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send(implementation_type&, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Receive some data from the peer. Returns the number of bytes received.
@@ -311,23 +313,26 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive(implementation_type&, const MutableBufferSequence&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Wait until data can be received without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_receive(implementation_type&, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Receive some data with associated flags. Returns the number of bytes
@@ -352,25 +357,28 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive_with_flags(implementation_type&,
const MutableBufferSequence&, socket_base::message_flags,
- socket_base::message_flags&, Handler& handler)
+ socket_base::message_flags&, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_with_flags(implementation_type&,
- const null_buffers&, socket_base::message_flags,
- socket_base::message_flags&, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive_with_flags(implementation_type&, const null_buffers&,
+ socket_base::message_flags, socket_base::message_flags&,
+ Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Send a datagram to the specified endpoint. Returns the number of bytes
@@ -395,24 +403,27 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send_to(implementation_type&, const ConstBufferSequence&,
const endpoint_type&, socket_base::message_flags,
Handler& handler)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send_to(implementation_type&, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
+ const endpoint_type&, socket_base::message_flags,
+ Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Receive a datagram with the endpoint of the sender. Returns the number of
@@ -438,25 +449,28 @@ public:
// Start an asynchronous receive. The buffer for the data being received and
// the sender_endpoint object must both be valid for the lifetime of the
// asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_receive_from(implementation_type&,
- const MutableBufferSequence&, endpoint_type&,
- socket_base::message_flags, Handler& handler)
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
+ void async_receive_from(implementation_type&, const MutableBufferSequence&,
+ endpoint_type&, socket_base::message_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_from(implementation_type&,
- const null_buffers&, endpoint_type&,
- socket_base::message_flags, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive_from(implementation_type&, const null_buffers&,
+ endpoint_type&, socket_base::message_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.post(detail::bind_handler(handler, ec, bytes_transferred));
+ boost::asio::post(io_ex, detail::bind_handler(
+ handler, ec, bytes_transferred));
}
// Accept a new connection.
@@ -470,12 +484,12 @@ public:
// Start an asynchronous accept. The peer and peer_endpoint objects
// must be valid until the accept's handler is invoked.
- template <typename Socket, typename Handler>
- void async_accept(implementation_type&, Socket&,
- endpoint_type*, Handler& handler)
+ template <typename Socket, typename Handler, typename IoExecutor>
+ void async_accept(implementation_type&, Socket&, endpoint_type*,
+ Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
- io_context_.post(detail::bind_handler(handler, ec));
+ boost::asio::post(io_ex, detail::bind_handler(handler, ec));
}
// Connect the socket to the specified endpoint.
@@ -487,16 +501,13 @@ public:
}
// Start an asynchronous connect.
- template <typename Handler>
- void async_connect(implementation_type&,
- const endpoint_type&, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_connect(implementation_type&, const endpoint_type&,
+ Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
- io_context_.post(detail::bind_handler(handler, ec));
+ boost::asio::post(io_ex, detail::bind_handler(handler, ec));
}
-
-private:
- boost::asio::io_context& io_context_;
};
} // namespace detail
diff --git a/boost/asio/detail/null_static_mutex.hpp b/boost/asio/detail/null_static_mutex.hpp
index 7e2c0b522c..f8f9ab4e04 100644
--- a/boost/asio/detail/null_static_mutex.hpp
+++ b/boost/asio/detail/null_static_mutex.hpp
@@ -2,7 +2,7 @@
// detail/null_static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_thread.hpp b/boost/asio/detail/null_thread.hpp
index 56ad8bf806..bd1360c09f 100644
--- a/boost/asio/detail/null_thread.hpp
+++ b/boost/asio/detail/null_thread.hpp
@@ -2,7 +2,7 @@
// detail/null_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/null_tss_ptr.hpp b/boost/asio/detail/null_tss_ptr.hpp
index 06d5a4d522..eacf4ff4a8 100644
--- a/boost/asio/detail/null_tss_ptr.hpp
+++ b/boost/asio/detail/null_tss_ptr.hpp
@@ -2,7 +2,7 @@
// detail/null_tss_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/object_pool.hpp b/boost/asio/detail/object_pool.hpp
index 7e454a7138..0eadf7ab97 100644
--- a/boost/asio/detail/object_pool.hpp
+++ b/boost/asio/detail/object_pool.hpp
@@ -2,7 +2,7 @@
// detail/object_pool.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/old_win_sdk_compat.hpp b/boost/asio/detail/old_win_sdk_compat.hpp
index f1b63cba0e..f5cb9d74b9 100644
--- a/boost/asio/detail/old_win_sdk_compat.hpp
+++ b/boost/asio/detail/old_win_sdk_compat.hpp
@@ -2,7 +2,7 @@
// detail/old_win_sdk_compat.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/op_queue.hpp b/boost/asio/detail/op_queue.hpp
index 935e45920f..b2cd608cb0 100644
--- a/boost/asio/detail/op_queue.hpp
+++ b/boost/asio/detail/op_queue.hpp
@@ -2,7 +2,7 @@
// detail/op_queue.hpp
// ~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/operation.hpp b/boost/asio/detail/operation.hpp
index 13220231ab..4baed817f4 100644
--- a/boost/asio/detail/operation.hpp
+++ b/boost/asio/detail/operation.hpp
@@ -2,7 +2,7 @@
// detail/operation.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/pipe_select_interrupter.hpp b/boost/asio/detail/pipe_select_interrupter.hpp
index 696d565729..01a467a415 100644
--- a/boost/asio/detail/pipe_select_interrupter.hpp
+++ b/boost/asio/detail/pipe_select_interrupter.hpp
@@ -2,7 +2,7 @@
// detail/pipe_select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/pop_options.hpp b/boost/asio/detail/pop_options.hpp
index 10450eacb5..3346b96fa4 100644
--- a/boost/asio/detail/pop_options.hpp
+++ b/boost/asio/detail/pop_options.hpp
@@ -2,7 +2,7 @@
// detail/pop_options.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -24,7 +24,9 @@
// Intel C++
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility pop
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility pop
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
#elif defined(__clang__)
@@ -42,7 +44,9 @@
# endif
# if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
-# pragma GCC visibility pop
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility pop
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
#elif defined(__GNUC__)
@@ -64,7 +68,9 @@
# endif
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility pop
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility pop
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# if (__GNUC__ >= 7)
diff --git a/boost/asio/detail/posix_event.hpp b/boost/asio/detail/posix_event.hpp
index 98529eaf26..98a796c9df 100644
--- a/boost/asio/detail/posix_event.hpp
+++ b/boost/asio/detail/posix_event.hpp
@@ -2,7 +2,7 @@
// detail/posix_event.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -130,7 +130,7 @@ public:
if (::clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
{
ts.tv_sec += usec / 1000000;
- ts.tv_nsec = (usec % 1000000) * 1000;
+ ts.tv_nsec += (usec % 1000000) * 1000;
ts.tv_sec += ts.tv_nsec / 1000000000;
ts.tv_nsec = ts.tv_nsec % 1000000000;
::pthread_cond_timedwait(&cond_,
diff --git a/boost/asio/detail/posix_fd_set_adapter.hpp b/boost/asio/detail/posix_fd_set_adapter.hpp
index f68f2aa1c4..17faa564a8 100644
--- a/boost/asio/detail/posix_fd_set_adapter.hpp
+++ b/boost/asio/detail/posix_fd_set_adapter.hpp
@@ -2,7 +2,7 @@
// detail/posix_fd_set_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_global.hpp b/boost/asio/detail/posix_global.hpp
index c2c2996f88..357fe150cb 100644
--- a/boost/asio/detail/posix_global.hpp
+++ b/boost/asio/detail/posix_global.hpp
@@ -2,7 +2,7 @@
// detail/posix_global.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_mutex.hpp b/boost/asio/detail/posix_mutex.hpp
index 5e1d42c530..1418ab5759 100644
--- a/boost/asio/detail/posix_mutex.hpp
+++ b/boost/asio/detail/posix_mutex.hpp
@@ -2,7 +2,7 @@
// detail/posix_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_signal_blocker.hpp b/boost/asio/detail/posix_signal_blocker.hpp
index ea5758fb2c..729da819f6 100644
--- a/boost/asio/detail/posix_signal_blocker.hpp
+++ b/boost/asio/detail/posix_signal_blocker.hpp
@@ -2,7 +2,7 @@
// detail/posix_signal_blocker.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_static_mutex.hpp b/boost/asio/detail/posix_static_mutex.hpp
index cbf7013c2d..331868f0d4 100644
--- a/boost/asio/detail/posix_static_mutex.hpp
+++ b/boost/asio/detail/posix_static_mutex.hpp
@@ -2,7 +2,7 @@
// detail/posix_static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_thread.hpp b/boost/asio/detail/posix_thread.hpp
index b2821f5356..b9cd59424f 100644
--- a/boost/asio/detail/posix_thread.hpp
+++ b/boost/asio/detail/posix_thread.hpp
@@ -2,7 +2,7 @@
// detail/posix_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/posix_tss_ptr.hpp b/boost/asio/detail/posix_tss_ptr.hpp
index 93d06744a7..126c148d3b 100644
--- a/boost/asio/detail/posix_tss_ptr.hpp
+++ b/boost/asio/detail/posix_tss_ptr.hpp
@@ -2,7 +2,7 @@
// detail/posix_tss_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/push_options.hpp b/boost/asio/detail/push_options.hpp
index 4927df93a2..679ac273c2 100644
--- a/boost/asio/detail/push_options.hpp
+++ b/boost/asio/detail/push_options.hpp
@@ -2,7 +2,7 @@
// detail/push_options.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -24,7 +24,9 @@
// Intel C++
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility push (default)
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility push (default)
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
#elif defined(__clang__)
@@ -44,7 +46,9 @@
# endif
# if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
-# pragma GCC visibility push (default)
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility push (default)
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
#elif defined(__GNUC__)
@@ -68,7 +72,9 @@
# endif
# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
-# pragma GCC visibility push (default)
+# if !defined(BOOST_ASIO_DISABLE_VISIBILITY)
+# pragma GCC visibility push (default)
+# endif // !defined(BOOST_ASIO_DISABLE_VISIBILITY)
# endif // (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
# if (__GNUC__ >= 7)
diff --git a/boost/asio/detail/reactive_descriptor_service.hpp b/boost/asio/detail/reactive_descriptor_service.hpp
index ac50a8ccb9..beed44a0ab 100644
--- a/boost/asio/detail/reactive_descriptor_service.hpp
+++ b/boost/asio/detail/reactive_descriptor_service.hpp
@@ -2,7 +2,7 @@
// detail/reactive_descriptor_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -22,7 +22,7 @@
&& !defined(__CYGWIN__)
#include <boost/asio/buffer.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/descriptor_ops.hpp>
@@ -43,7 +43,7 @@ namespace asio {
namespace detail {
class reactive_descriptor_service :
- public service_base<reactive_descriptor_service>
+ public execution_context_service_base<reactive_descriptor_service>
{
public:
// The native type of a descriptor.
@@ -76,8 +76,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL reactive_descriptor_service(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL reactive_descriptor_service(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -191,18 +190,19 @@ public:
// Asynchronously wait for the descriptor to become ready to read, ready to
// write, or to have pending error conditions.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_wait(implementation_type& impl,
- posix::descriptor_base::wait_type w, Handler& handler)
+ posix::descriptor_base::wait_type w,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_wait_op<Handler> op;
+ typedef reactive_wait_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
&impl, impl.descriptor_, "async_wait"));
@@ -254,18 +254,19 @@ public:
// Start an asynchronous write. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler& handler,
+ const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef descriptor_write_op<ConstBufferSequence, Handler> op;
+ typedef descriptor_write_op<ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.descriptor_, buffers, handler);
+ p.p = new (p.v) op(impl.descriptor_, buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
&impl, impl.descriptor_, "async_write_some"));
@@ -277,18 +278,18 @@ public:
}
// Start an asynchronous wait until data can be written without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
+ const null_buffers&, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
&impl, impl.descriptor_, "async_write_some(null_buffers)"));
@@ -321,18 +322,20 @@ public:
// Start an asynchronous read. The buffer for the data being read must be
// valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef descriptor_read_op<MutableBufferSequence, Handler> op;
+ typedef descriptor_read_op<MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.descriptor_, buffers, handler);
+ p.p = new (p.v) op(impl.descriptor_, buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
&impl, impl.descriptor_, "async_read_some"));
@@ -344,18 +347,18 @@ public:
}
// Wait until data can be read without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const null_buffers&, Handler& handler)
+ const null_buffers&, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "descriptor",
&impl, impl.descriptor_, "async_read_some(null_buffers)"));
diff --git a/boost/asio/detail/reactive_null_buffers_op.hpp b/boost/asio/detail/reactive_null_buffers_op.hpp
index dca3a3285f..fb25be335f 100644
--- a/boost/asio/detail/reactive_null_buffers_op.hpp
+++ b/boost/asio/detail/reactive_null_buffers_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_null_buffers_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,18 +28,19 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class reactive_null_buffers_op : public reactor_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_null_buffers_op);
- reactive_null_buffers_op(Handler& handler)
+ reactive_null_buffers_op(Handler& handler, const IoExecutor& io_ex)
: reactor_op(&reactive_null_buffers_op::do_perform,
&reactive_null_buffers_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static status do_perform(reactor_op*)
@@ -54,7 +55,7 @@ public:
// Take ownership of the handler object.
reactive_null_buffers_op* o(static_cast<reactive_null_buffers_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -81,6 +82,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_serial_port_service.hpp b/boost/asio/detail/reactive_serial_port_service.hpp
index 42ff500d2c..ae752d06da 100644
--- a/boost/asio/detail/reactive_serial_port_service.hpp
+++ b/boost/asio/detail/reactive_serial_port_service.hpp
@@ -2,7 +2,7 @@
// detail/reactive_serial_port_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -23,7 +23,7 @@
#include <string>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/serial_port_base.hpp>
#include <boost/asio/detail/descriptor_ops.hpp>
#include <boost/asio/detail/reactive_descriptor_service.hpp>
@@ -36,7 +36,7 @@ namespace detail {
// Extend reactive_descriptor_service to provide serial port support.
class reactive_serial_port_service :
- public service_base<reactive_serial_port_service>
+ public execution_context_service_base<reactive_serial_port_service>
{
public:
// The native type of a serial port.
@@ -45,8 +45,7 @@ public:
// The implementation type of the serial port.
typedef reactive_descriptor_service::implementation_type implementation_type;
- BOOST_ASIO_DECL reactive_serial_port_service(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL reactive_serial_port_service(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -157,11 +156,12 @@ public:
// Start an asynchronous write. The data being written must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
- descriptor_service_.async_write_some(impl, buffers, handler);
+ descriptor_service_.async_write_some(impl, buffers, handler, io_ex);
}
// Read some data. Returns the number of bytes received.
@@ -174,11 +174,13 @@ public:
// Start an asynchronous read. The buffer for the data being received must be
// valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
- descriptor_service_.async_read_some(impl, buffers, handler);
+ descriptor_service_.async_read_some(impl, buffers, handler, io_ex);
}
private:
diff --git a/boost/asio/detail/reactive_socket_accept_op.hpp b/boost/asio/detail/reactive_socket_accept_op.hpp
index 292f3bdf25..972e01618c 100644
--- a/boost/asio/detail/reactive_socket_accept_op.hpp
+++ b/boost/asio/detail/reactive_socket_accept_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_accept_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -86,7 +86,8 @@ private:
std::size_t addrlen_;
};
-template <typename Socket, typename Protocol, typename Handler>
+template <typename Socket, typename Protocol,
+ typename Handler, typename IoExecutor>
class reactive_socket_accept_op :
public reactive_socket_accept_op_base<Socket, Protocol>
{
@@ -95,12 +96,14 @@ public:
reactive_socket_accept_op(socket_type socket,
socket_ops::state_type state, Socket& peer, const Protocol& protocol,
- typename Protocol::endpoint* peer_endpoint, Handler& handler)
+ typename Protocol::endpoint* peer_endpoint, Handler& handler,
+ const IoExecutor& io_ex)
: reactive_socket_accept_op_base<Socket, Protocol>(socket, state, peer,
protocol, peer_endpoint, &reactive_socket_accept_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -110,7 +113,7 @@ public:
// Take ownership of the handler object.
reactive_socket_accept_op* o(static_cast<reactive_socket_accept_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
// On success, assign new connection to peer socket object.
if (owner)
@@ -141,28 +144,34 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
#if defined(BOOST_ASIO_HAS_MOVE)
-template <typename Protocol, typename Handler>
+template <typename Protocol, typename PeerIoExecutor,
+ typename Handler, typename IoExecutor>
class reactive_socket_move_accept_op :
- private Protocol::socket,
- public reactive_socket_accept_op_base<typename Protocol::socket, Protocol>
+ private Protocol::socket::template rebind_executor<PeerIoExecutor>::other,
+ public reactive_socket_accept_op_base<
+ typename Protocol::socket::template rebind_executor<PeerIoExecutor>::other,
+ Protocol>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_move_accept_op);
- reactive_socket_move_accept_op(io_context& ioc, socket_type socket,
- socket_ops::state_type state, const Protocol& protocol,
- typename Protocol::endpoint* peer_endpoint, Handler& handler)
- : Protocol::socket(ioc),
- reactive_socket_accept_op_base<typename Protocol::socket, Protocol>(
+ reactive_socket_move_accept_op(const PeerIoExecutor& peer_io_ex,
+ socket_type socket, socket_ops::state_type state,
+ const Protocol& protocol, typename Protocol::endpoint* peer_endpoint,
+ Handler& handler, const IoExecutor& io_ex)
+ : peer_socket_type(peer_io_ex),
+ reactive_socket_accept_op_base<peer_socket_type, Protocol>(
socket, state, *this, protocol, peer_endpoint,
&reactive_socket_move_accept_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -173,7 +182,7 @@ public:
reactive_socket_move_accept_op* o(
static_cast<reactive_socket_move_accept_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
// On success, assign new connection to peer socket object.
if (owner)
@@ -188,9 +197,9 @@ public:
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::move_binder2<Handler,
- boost::system::error_code, typename Protocol::socket>
+ boost::system::error_code, peer_socket_type>
handler(0, BOOST_ASIO_MOVE_CAST(Handler)(o->handler_), o->ec_,
- BOOST_ASIO_MOVE_CAST(typename Protocol::socket)(*o));
+ BOOST_ASIO_MOVE_CAST(peer_socket_type)(*o));
p.h = boost::asio::detail::addressof(handler.handler_);
p.reset();
@@ -205,7 +214,11 @@ public:
}
private:
+ typedef typename Protocol::socket::template
+ rebind_executor<PeerIoExecutor>::other peer_socket_type;
+
Handler handler_;
+ IoExecutor io_executor_;
};
#endif // defined(BOOST_ASIO_HAS_MOVE)
diff --git a/boost/asio/detail/reactive_socket_connect_op.hpp b/boost/asio/detail/reactive_socket_connect_op.hpp
index bbb5020501..e8701da312 100644
--- a/boost/asio/detail/reactive_socket_connect_op.hpp
+++ b/boost/asio/detail/reactive_socket_connect_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_connect_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -55,18 +55,20 @@ private:
socket_type socket_;
};
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class reactive_socket_connect_op : public reactive_socket_connect_op_base
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_connect_op);
- reactive_socket_connect_op(socket_type socket, Handler& handler)
+ reactive_socket_connect_op(socket_type socket,
+ Handler& handler, const IoExecutor& io_ex)
: reactive_socket_connect_op_base(socket,
&reactive_socket_connect_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -77,7 +79,7 @@ public:
reactive_socket_connect_op* o
(static_cast<reactive_socket_connect_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -104,6 +106,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_recv_op.hpp b/boost/asio/detail/reactive_socket_recv_op.hpp
index 0f124627bd..1d6889dcce 100644
--- a/boost/asio/detail/reactive_socket_recv_op.hpp
+++ b/boost/asio/detail/reactive_socket_recv_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_recv_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -75,21 +75,22 @@ private:
socket_base::message_flags flags_;
};
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class reactive_socket_recv_op :
public reactive_socket_recv_op_base<MutableBufferSequence>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recv_op);
- reactive_socket_recv_op(socket_type socket,
- socket_ops::state_type state, const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ reactive_socket_recv_op(socket_type socket, socket_ops::state_type state,
+ const MutableBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
: reactive_socket_recv_op_base<MutableBufferSequence>(socket, state,
buffers, flags, &reactive_socket_recv_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -99,7 +100,7 @@ public:
// Take ownership of the handler object.
reactive_socket_recv_op* o(static_cast<reactive_socket_recv_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -126,6 +127,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_recvfrom_op.hpp b/boost/asio/detail/reactive_socket_recvfrom_op.hpp
index b96a01327a..09aceba82f 100644
--- a/boost/asio/detail/reactive_socket_recvfrom_op.hpp
+++ b/boost/asio/detail/reactive_socket_recvfrom_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_recvfrom_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -76,7 +76,8 @@ private:
socket_base::message_flags flags_;
};
-template <typename MutableBufferSequence, typename Endpoint, typename Handler>
+template <typename MutableBufferSequence, typename Endpoint,
+ typename Handler, typename IoExecutor>
class reactive_socket_recvfrom_op :
public reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>
{
@@ -85,13 +86,15 @@ public:
reactive_socket_recvfrom_op(socket_type socket, int protocol_type,
const MutableBufferSequence& buffers, Endpoint& endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler& handler,
+ const IoExecutor& io_ex)
: reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>(
socket, protocol_type, buffers, endpoint, flags,
&reactive_socket_recvfrom_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -102,7 +105,7 @@ public:
reactive_socket_recvfrom_op* o(
static_cast<reactive_socket_recvfrom_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -129,6 +132,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_recvmsg_op.hpp b/boost/asio/detail/reactive_socket_recvmsg_op.hpp
index 6ae324947c..bb65a19cf4 100644
--- a/boost/asio/detail/reactive_socket_recvmsg_op.hpp
+++ b/boost/asio/detail/reactive_socket_recvmsg_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_recvmsg_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -71,7 +71,7 @@ private:
socket_base::message_flags& out_flags_;
};
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class reactive_socket_recvmsg_op :
public reactive_socket_recvmsg_op_base<MutableBufferSequence>
{
@@ -80,12 +80,14 @@ public:
reactive_socket_recvmsg_op(socket_type socket,
const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler& handler,
+ const IoExecutor& io_ex)
: reactive_socket_recvmsg_op_base<MutableBufferSequence>(socket, buffers,
in_flags, out_flags, &reactive_socket_recvmsg_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -96,7 +98,7 @@ public:
reactive_socket_recvmsg_op* o(
static_cast<reactive_socket_recvmsg_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -123,6 +125,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_send_op.hpp b/boost/asio/detail/reactive_socket_send_op.hpp
index 11f3ad80af..6be6081cc9 100644
--- a/boost/asio/detail/reactive_socket_send_op.hpp
+++ b/boost/asio/detail/reactive_socket_send_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_send_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -74,21 +74,22 @@ private:
socket_base::message_flags flags_;
};
-template <typename ConstBufferSequence, typename Handler>
+template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
class reactive_socket_send_op :
public reactive_socket_send_op_base<ConstBufferSequence>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_send_op);
- reactive_socket_send_op(socket_type socket,
- socket_ops::state_type state, const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ reactive_socket_send_op(socket_type socket, socket_ops::state_type state,
+ const ConstBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
: reactive_socket_send_op_base<ConstBufferSequence>(socket,
state, buffers, flags, &reactive_socket_send_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -98,7 +99,7 @@ public:
// Take ownership of the handler object.
reactive_socket_send_op* o(static_cast<reactive_socket_send_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -125,6 +126,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_sendto_op.hpp b/boost/asio/detail/reactive_socket_sendto_op.hpp
index a73934bfc1..3429a7585e 100644
--- a/boost/asio/detail/reactive_socket_sendto_op.hpp
+++ b/boost/asio/detail/reactive_socket_sendto_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_sendto_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -70,7 +70,8 @@ private:
socket_base::message_flags flags_;
};
-template <typename ConstBufferSequence, typename Endpoint, typename Handler>
+template <typename ConstBufferSequence, typename Endpoint,
+ typename Handler, typename IoExecutor>
class reactive_socket_sendto_op :
public reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>
{
@@ -79,12 +80,14 @@ public:
reactive_socket_sendto_op(socket_type socket,
const ConstBufferSequence& buffers, const Endpoint& endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler& handler,
+ const IoExecutor& io_ex)
: reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>(socket,
buffers, endpoint, flags, &reactive_socket_sendto_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -94,7 +97,7 @@ public:
// Take ownership of the handler object.
reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -121,6 +124,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactive_socket_service.hpp b/boost/asio/detail/reactive_socket_service.hpp
index 89940d9af0..fb3a0e4660 100644
--- a/boost/asio/detail/reactive_socket_service.hpp
+++ b/boost/asio/detail/reactive_socket_service.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,7 +21,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/memory.hpp>
@@ -46,7 +46,7 @@ namespace detail {
template <typename Protocol>
class reactive_socket_service :
- public service_base<reactive_socket_service<Protocol> >,
+ public execution_context_service_base<reactive_socket_service<Protocol> >,
public reactive_socket_service_base
{
public:
@@ -74,9 +74,10 @@ public:
};
// Constructor.
- reactive_socket_service(boost::asio::io_context& io_context)
- : service_base<reactive_socket_service<Protocol> >(io_context),
- reactive_socket_service_base(io_context)
+ reactive_socket_service(execution_context& context)
+ : execution_context_service_base<
+ reactive_socket_service<Protocol> >(context),
+ reactive_socket_service_base(context)
{
}
@@ -240,21 +241,22 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send_to(implementation_type& impl,
const ConstBufferSequence& buffers,
const endpoint_type& destination, socket_base::message_flags flags,
- Handler& handler)
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
typedef reactive_socket_sendto_op<ConstBufferSequence,
- endpoint_type, Handler> op;
+ endpoint_type, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler);
+ p.p = new (p.v) op(impl.socket_, buffers,
+ destination, flags, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_send_to"));
@@ -264,18 +266,19 @@ public:
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
+ const endpoint_type&, socket_base::message_flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_send_to(null_buffers)"));
@@ -323,22 +326,24 @@ public:
// Start an asynchronous receive. The buffer for the data being received and
// the sender_endpoint object must both be valid for the lifetime of the
// asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive_from(implementation_type& impl,
const MutableBufferSequence& buffers, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler& handler,
+ const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
typedef reactive_socket_recvfrom_op<MutableBufferSequence,
- endpoint_type, Handler> op;
+ endpoint_type, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
int protocol = impl.protocol_.type();
- p.p = new (p.v) op(impl.socket_, protocol,
- buffers, sender_endpoint, flags, handler);
+ p.p = new (p.v) op(impl.socket_, protocol, buffers,
+ sender_endpoint, flags, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive_from"));
@@ -351,19 +356,19 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_from(implementation_type& impl,
- const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive_from(implementation_type& impl, const null_buffers&,
+ endpoint_type& sender_endpoint, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive_from(null_buffers)"));
@@ -408,49 +413,21 @@ public:
return ec;
}
-#if defined(BOOST_ASIO_HAS_MOVE)
- // Accept a new connection.
- typename Protocol::socket accept(implementation_type& impl,
- io_context* peer_io_context, endpoint_type* peer_endpoint,
- boost::system::error_code& ec)
- {
- typename Protocol::socket peer(
- peer_io_context ? *peer_io_context : io_context_);
-
- std::size_t addr_len = peer_endpoint ? peer_endpoint->capacity() : 0;
- socket_holder new_socket(socket_ops::sync_accept(impl.socket_,
- impl.state_, peer_endpoint ? peer_endpoint->data() : 0,
- peer_endpoint ? &addr_len : 0, ec));
-
- // On success, assign new connection to peer socket object.
- if (new_socket.get() != invalid_socket)
- {
- if (peer_endpoint)
- peer_endpoint->resize(addr_len);
- peer.assign(impl.protocol_, new_socket.get(), ec);
- if (!ec)
- new_socket.release();
- }
-
- return peer;
- }
-#endif // defined(BOOST_ASIO_HAS_MOVE)
-
// Start an asynchronous accept. The peer and peer_endpoint objects must be
// valid until the accept's handler is invoked.
- template <typename Socket, typename Handler>
+ template <typename Socket, typename Handler, typename IoExecutor>
void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
+ endpoint_type* peer_endpoint, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_accept_op<Socket, Protocol, Handler> op;
+ typedef reactive_socket_accept_op<Socket, Protocol, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
p.p = new (p.v) op(impl.socket_, impl.state_, peer,
- impl.protocol_, peer_endpoint, handler);
+ impl.protocol_, peer_endpoint, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_accept"));
@@ -462,20 +439,21 @@ public:
#if defined(BOOST_ASIO_HAS_MOVE)
// Start an asynchronous accept. The peer_endpoint object must be valid until
// the accept's handler is invoked.
- template <typename Handler>
- void async_accept(implementation_type& impl,
- boost::asio::io_context* peer_io_context,
- endpoint_type* peer_endpoint, Handler& handler)
+ template <typename PeerIoExecutor, typename Handler, typename IoExecutor>
+ void async_move_accept(implementation_type& impl,
+ const PeerIoExecutor& peer_io_ex, endpoint_type* peer_endpoint,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_move_accept_op<Protocol, Handler> op;
+ typedef reactive_socket_move_accept_op<Protocol,
+ PeerIoExecutor, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(peer_io_context ? *peer_io_context : io_context_,
- impl.socket_, impl.state_, impl.protocol_, peer_endpoint, handler);
+ p.p = new (p.v) op(peer_io_ex, impl.socket_, impl.state_,
+ impl.protocol_, peer_endpoint, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_accept"));
@@ -495,18 +473,19 @@ public:
}
// Start an asynchronous connect.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
+ const endpoint_type& peer_endpoint,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_connect_op<Handler> op;
+ typedef reactive_socket_connect_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, handler);
+ p.p = new (p.v) op(impl.socket_, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_connect"));
diff --git a/boost/asio/detail/reactive_socket_service_base.hpp b/boost/asio/detail/reactive_socket_service_base.hpp
index 9d3d54cc11..26fb828b01 100644
--- a/boost/asio/detail/reactive_socket_service_base.hpp
+++ b/boost/asio/detail/reactive_socket_service_base.hpp
@@ -2,7 +2,7 @@
// detail/reactive_socket_service_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -22,7 +22,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/memory.hpp>
@@ -63,8 +63,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL reactive_socket_service_base(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL reactive_socket_service_base(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void base_shutdown();
@@ -194,18 +193,18 @@ public:
// Asynchronously wait for the socket to become ready to read, ready to
// write, or to have pending error conditions.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_wait(base_implementation_type& impl,
- socket_base::wait_type w, Handler& handler)
+ socket_base::wait_type w, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_wait_op<Handler> op;
+ typedef reactive_wait_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_wait"));
@@ -258,19 +257,21 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send(base_implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const ConstBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_send_op<ConstBufferSequence, Handler> op;
+ typedef reactive_socket_send_op<
+ ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler);
+ p.p = new (p.v) op(impl.socket_, impl.state_,
+ buffers, flags, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_send"));
@@ -283,18 +284,18 @@ public:
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_send(null_buffers)"));
@@ -328,19 +329,22 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const MutableBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recv_op<MutableBufferSequence, Handler> op;
+ typedef reactive_socket_recv_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler);
+ p.p = new (p.v) op(impl.socket_, impl.state_,
+ buffers, flags, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive"));
@@ -357,18 +361,19 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags flags, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive(null_buffers)"));
@@ -412,19 +417,23 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive_with_flags(base_implementation_type& impl,
const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op;
+ typedef reactive_socket_recvmsg_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler);
+ p.p = new (p.v) op(impl.socket_, buffers,
+ in_flags, out_flags, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive_with_flags"));
@@ -438,19 +447,20 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_receive_with_flags(base_implementation_type& impl,
const null_buffers&, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef reactive_null_buffers_op<Handler> op;
+ typedef reactive_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((reactor_.context(), *p.p, "socket",
&impl, impl.socket_, "async_receive_with_flags(null_buffers)"));
@@ -490,9 +500,6 @@ protected:
reactor_op* op, bool is_continuation,
const socket_addr_type* addr, size_t addrlen);
- // The io_context that owns this socket service.
- io_context& io_context_;
-
// The selector that performs event demultiplexing for the service.
reactor& reactor_;
};
diff --git a/boost/asio/detail/reactive_wait_op.hpp b/boost/asio/detail/reactive_wait_op.hpp
index ee32502482..021059dcd5 100644
--- a/boost/asio/detail/reactive_wait_op.hpp
+++ b/boost/asio/detail/reactive_wait_op.hpp
@@ -2,7 +2,7 @@
// detail/reactive_wait_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,18 +28,19 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class reactive_wait_op : public reactor_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_wait_op);
- reactive_wait_op(Handler& handler)
+ reactive_wait_op(Handler& handler, const IoExecutor& io_ex)
: reactor_op(&reactive_wait_op::do_perform,
&reactive_wait_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static status do_perform(reactor_op*)
@@ -54,7 +55,7 @@ public:
// Take ownership of the handler object.
reactive_wait_op* o(static_cast<reactive_wait_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -81,6 +82,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/reactor.hpp b/boost/asio/detail/reactor.hpp
index f1e5d95864..bfe999bed3 100644
--- a/boost/asio/detail/reactor.hpp
+++ b/boost/asio/detail/reactor.hpp
@@ -2,7 +2,7 @@
// detail/reactor.hpp
// ~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/reactor_fwd.hpp b/boost/asio/detail/reactor_fwd.hpp
index b222b134e6..2ea1eec99e 100644
--- a/boost/asio/detail/reactor_fwd.hpp
+++ b/boost/asio/detail/reactor_fwd.hpp
@@ -2,7 +2,7 @@
// detail/reactor_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/reactor_op.hpp b/boost/asio/detail/reactor_op.hpp
index beb443eb69..4c399a5036 100644
--- a/boost/asio/detail/reactor_op.hpp
+++ b/boost/asio/detail/reactor_op.hpp
@@ -2,7 +2,7 @@
// detail/reactor_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/reactor_op_queue.hpp b/boost/asio/detail/reactor_op_queue.hpp
index fec0dd7d37..dd28b6dc98 100644
--- a/boost/asio/detail/reactor_op_queue.hpp
+++ b/boost/asio/detail/reactor_op_queue.hpp
@@ -2,7 +2,7 @@
// detail/reactor_op_queue.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/recycling_allocator.hpp b/boost/asio/detail/recycling_allocator.hpp
index adab0a7a61..74003bfdd6 100644
--- a/boost/asio/detail/recycling_allocator.hpp
+++ b/boost/asio/detail/recycling_allocator.hpp
@@ -2,7 +2,7 @@
// detail/recycling_allocator.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -26,7 +26,7 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename T>
+template <typename T, typename Purpose = thread_info_base::default_tag>
class recycling_allocator
{
public:
@@ -35,7 +35,7 @@ public:
template <typename U>
struct rebind
{
- typedef recycling_allocator<U> other;
+ typedef recycling_allocator<U, Purpose> other;
};
recycling_allocator()
@@ -43,26 +43,28 @@ public:
}
template <typename U>
- recycling_allocator(const recycling_allocator<U>&)
+ recycling_allocator(const recycling_allocator<U, Purpose>&)
{
}
T* allocate(std::size_t n)
{
typedef thread_context::thread_call_stack call_stack;
- void* p = thread_info_base::allocate(call_stack::top(), sizeof(T) * n);
+ void* p = thread_info_base::allocate(Purpose(),
+ call_stack::top(), sizeof(T) * n);
return static_cast<T*>(p);
}
void deallocate(T* p, std::size_t n)
{
typedef thread_context::thread_call_stack call_stack;
- thread_info_base::deallocate(call_stack::top(), p, sizeof(T) * n);
+ thread_info_base::deallocate(Purpose(),
+ call_stack::top(), p, sizeof(T) * n);
}
};
-template <>
-class recycling_allocator<void>
+template <typename Purpose>
+class recycling_allocator<void, Purpose>
{
public:
typedef void value_type;
@@ -70,7 +72,7 @@ public:
template <typename U>
struct rebind
{
- typedef recycling_allocator<U> other;
+ typedef recycling_allocator<U, Purpose> other;
};
recycling_allocator()
@@ -78,22 +80,22 @@ public:
}
template <typename U>
- recycling_allocator(const recycling_allocator<U>&)
+ recycling_allocator(const recycling_allocator<U, Purpose>&)
{
}
};
-template <typename Allocator>
+template <typename Allocator, typename Purpose>
struct get_recycling_allocator
{
typedef Allocator type;
static type get(const Allocator& a) { return a; }
};
-template <typename T>
-struct get_recycling_allocator<std::allocator<T> >
+template <typename T, typename Purpose>
+struct get_recycling_allocator<std::allocator<T>, Purpose>
{
- typedef recycling_allocator<T> type;
+ typedef recycling_allocator<T, Purpose> type;
static type get(const std::allocator<T>&) { return type(); }
};
diff --git a/boost/asio/detail/regex_fwd.hpp b/boost/asio/detail/regex_fwd.hpp
index 4d35a68ab9..a2dd26dff4 100644
--- a/boost/asio/detail/regex_fwd.hpp
+++ b/boost/asio/detail/regex_fwd.hpp
@@ -2,7 +2,7 @@
// detail/regex_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/resolve_endpoint_op.hpp b/boost/asio/detail/resolve_endpoint_op.hpp
index 970544c783..72df8d94ac 100644
--- a/boost/asio/detail/resolve_endpoint_op.hpp
+++ b/boost/asio/detail/resolve_endpoint_op.hpp
@@ -2,7 +2,7 @@
// detail/resolve_endpoint_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -17,7 +17,6 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/basic_resolver_results.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/fenced_block.hpp>
@@ -27,13 +26,19 @@
#include <boost/asio/detail/resolve_op.hpp>
#include <boost/asio/detail/socket_ops.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
-template <typename Protocol, typename Handler>
+template <typename Protocol, typename Handler, typename IoExecutor>
class resolve_endpoint_op : public resolve_op
{
public:
@@ -42,15 +47,23 @@ public:
typedef typename Protocol::endpoint endpoint_type;
typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+
resolve_endpoint_op(socket_ops::weak_cancel_token_type cancel_token,
- const endpoint_type& endpoint, io_context_impl& ioc, Handler& handler)
+ const endpoint_type& endpoint, scheduler_impl& sched,
+ Handler& handler, const IoExecutor& io_ex)
: resolve_op(&resolve_endpoint_op::do_complete),
cancel_token_(cancel_token),
endpoint_(endpoint),
- io_context_impl_(ioc),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ scheduler_(sched),
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -60,9 +73,9 @@ public:
// Take ownership of the operation object.
resolve_endpoint_op* o(static_cast<resolve_endpoint_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
- if (owner && owner != &o->io_context_impl_)
+ if (owner && owner != &o->scheduler_)
{
// The operation is being run on the worker io_context. Time to perform
// the resolver operation.
@@ -76,7 +89,7 @@ public:
o->results_ = results_type::create(o->endpoint_, host_name, service_name);
// Pass operation back to main io_context for completion.
- o->io_context_impl_.post_deferred_completion(o);
+ o->scheduler_.post_deferred_completion(o);
p.v = p.p = 0;
}
else
@@ -110,8 +123,9 @@ public:
private:
socket_ops::weak_cancel_token_type cancel_token_;
endpoint_type endpoint_;
- io_context_impl& io_context_impl_;
+ scheduler_impl& scheduler_;
Handler handler_;
+ IoExecutor io_executor_;
results_type results_;
};
diff --git a/boost/asio/detail/resolve_op.hpp b/boost/asio/detail/resolve_op.hpp
index fd72994fc5..2be7b196ec 100644
--- a/boost/asio/detail/resolve_op.hpp
+++ b/boost/asio/detail/resolve_op.hpp
@@ -2,7 +2,7 @@
// detail/resolve_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/resolve_query_op.hpp b/boost/asio/detail/resolve_query_op.hpp
index 91bdd79654..11d5989671 100644
--- a/boost/asio/detail/resolve_query_op.hpp
+++ b/boost/asio/detail/resolve_query_op.hpp
@@ -2,7 +2,7 @@
// detail/resolve_query_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -17,7 +17,6 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
#include <boost/asio/ip/basic_resolver_query.hpp>
#include <boost/asio/ip/basic_resolver_results.hpp>
#include <boost/asio/detail/bind_handler.hpp>
@@ -28,13 +27,19 @@
#include <boost/asio/detail/resolve_op.hpp>
#include <boost/asio/detail/socket_ops.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
namespace asio {
namespace detail {
-template <typename Protocol, typename Handler>
+template <typename Protocol, typename Handler, typename IoExecutor>
class resolve_query_op : public resolve_op
{
public:
@@ -43,16 +48,24 @@ public:
typedef boost::asio::ip::basic_resolver_query<Protocol> query_type;
typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+
resolve_query_op(socket_ops::weak_cancel_token_type cancel_token,
- const query_type& query, io_context_impl& ioc, Handler& handler)
+ const query_type& query, scheduler_impl& sched,
+ Handler& handler, const IoExecutor& io_ex)
: resolve_op(&resolve_query_op::do_complete),
cancel_token_(cancel_token),
query_(query),
- io_context_impl_(ioc),
+ scheduler_(sched),
handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex),
addrinfo_(0)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
~resolve_query_op()
@@ -69,7 +82,7 @@ public:
resolve_query_op* o(static_cast<resolve_query_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- if (owner && owner != &o->io_context_impl_)
+ if (owner && owner != &o->scheduler_)
{
// The operation is being run on the worker io_context. Time to perform
// the resolver operation.
@@ -80,7 +93,7 @@ public:
o->query_.hints(), &o->addrinfo_, o->ec_);
// Pass operation back to main io_context for completion.
- o->io_context_impl_.post_deferred_completion(o);
+ o->scheduler_.post_deferred_completion(o);
p.v = p.p = 0;
}
else
@@ -89,7 +102,7 @@ public:
// handler is ready to be delivered.
// Take ownership of the operation's outstanding work.
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -122,8 +135,9 @@ public:
private:
socket_ops::weak_cancel_token_type cancel_token_;
query_type query_;
- io_context_impl& io_context_impl_;
+ scheduler_impl& scheduler_;
Handler handler_;
+ IoExecutor io_executor_;
boost::asio::detail::addrinfo_type* addrinfo_;
};
diff --git a/boost/asio/detail/resolver_service.hpp b/boost/asio/detail/resolver_service.hpp
index 85c9c2a0a7..744b75ca46 100644
--- a/boost/asio/detail/resolver_service.hpp
+++ b/boost/asio/detail/resolver_service.hpp
@@ -2,7 +2,7 @@
// detail/resolver_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,7 +35,7 @@ namespace detail {
template <typename Protocol>
class resolver_service :
- public service_base<resolver_service<Protocol> >,
+ public execution_context_service_base<resolver_service<Protocol> >,
public resolver_service_base
{
public:
@@ -53,9 +53,9 @@ public:
typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
// Constructor.
- resolver_service(boost::asio::io_context& io_context)
- : service_base<resolver_service<Protocol> >(io_context),
- resolver_service_base(io_context)
+ resolver_service(execution_context& context)
+ : execution_context_service_base<resolver_service<Protocol> >(context),
+ resolver_service_base(context)
{
}
@@ -66,7 +66,7 @@ public:
}
// Perform any fork-related housekeeping.
- void notify_fork(boost::asio::io_context::fork_event fork_ev)
+ void notify_fork(execution_context::fork_event fork_ev)
{
this->base_notify_fork(fork_ev);
}
@@ -86,17 +86,17 @@ public:
}
// Asynchronously resolve a query to a list of entries.
- template <typename Handler>
- void async_resolve(implementation_type& impl,
- const query_type& query, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_resolve(implementation_type& impl, const query_type& query,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef resolve_query_op<Protocol, Handler> op;
+ typedef resolve_query_op<Protocol, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl, query, io_context_impl_, handler);
+ p.p = new (p.v) op(impl, query, scheduler_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_impl_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "resolver", &impl, 0, "async_resolve"));
start_resolve_op(p.p);
@@ -118,17 +118,17 @@ public:
}
// Asynchronously resolve an endpoint to a list of entries.
- template <typename Handler>
- void async_resolve(implementation_type& impl,
- const endpoint_type& endpoint, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_resolve(implementation_type& impl, const endpoint_type& endpoint,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef resolve_endpoint_op<Protocol, Handler> op;
+ typedef resolve_endpoint_op<Protocol, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl, endpoint, io_context_impl_, handler);
+ p.p = new (p.v) op(impl, endpoint, scheduler_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_impl_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "resolver", &impl, 0, "async_resolve"));
start_resolve_op(p.p);
diff --git a/boost/asio/detail/resolver_service_base.hpp b/boost/asio/detail/resolver_service_base.hpp
index 40adca655a..8e1ff5bea8 100644
--- a/boost/asio/detail/resolver_service_base.hpp
+++ b/boost/asio/detail/resolver_service_base.hpp
@@ -2,7 +2,7 @@
// detail/resolver_service_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -17,8 +17,7 @@
#include <boost/asio/detail/config.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/executor_work_guard.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/mutex.hpp>
#include <boost/asio/detail/noncopyable.hpp>
#include <boost/asio/detail/resolve_op.hpp>
@@ -27,6 +26,12 @@
#include <boost/asio/detail/scoped_ptr.hpp>
#include <boost/asio/detail/thread.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
@@ -41,7 +46,7 @@ public:
typedef socket_ops::shared_cancel_token_type implementation_type;
// Constructor.
- BOOST_ASIO_DECL resolver_service_base(boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL resolver_service_base(execution_context& context);
// Destructor.
BOOST_ASIO_DECL ~resolver_service_base();
@@ -51,7 +56,7 @@ public:
// Perform any fork-related housekeeping.
BOOST_ASIO_DECL void base_notify_fork(
- boost::asio::io_context::fork_event fork_ev);
+ execution_context::fork_event fork_ev);
// Construct a new resolver implementation.
BOOST_ASIO_DECL void construct(implementation_type& impl);
@@ -102,28 +107,26 @@ protected:
};
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
- // Helper class to run the work io_context in a thread.
- class work_io_context_runner;
+ // Helper class to run the work scheduler in a thread.
+ class work_scheduler_runner;
- // Start the work thread if it's not already running.
+ // Start the work scheduler if it's not already running.
BOOST_ASIO_DECL void start_work_thread();
- // The io_context implementation used to post completions.
- io_context_impl& io_context_impl_;
+ // The scheduler implementation used to post completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
private:
// Mutex to protect access to internal data.
boost::asio::detail::mutex mutex_;
- // Private io_context used for performing asynchronous host resolution.
- boost::asio::detail::scoped_ptr<boost::asio::io_context> work_io_context_;
-
- // The work io_context implementation used to post completions.
- io_context_impl& work_io_context_impl_;
-
- // Work for the private io_context to perform.
- boost::asio::executor_work_guard<
- boost::asio::io_context::executor_type> work_;
+ // Private scheduler used for performing asynchronous host resolution.
+ boost::asio::detail::scoped_ptr<scheduler_impl> work_scheduler_;
// Thread used for running the work io_context's run loop.
boost::asio::detail::scoped_ptr<boost::asio::detail::thread> work_thread_;
diff --git a/boost/asio/detail/scheduler.hpp b/boost/asio/detail/scheduler.hpp
index 835e4c9237..e3861818d4 100644
--- a/boost/asio/detail/scheduler.hpp
+++ b/boost/asio/detail/scheduler.hpp
@@ -2,7 +2,7 @@
// detail/scheduler.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -25,6 +25,7 @@
#include <boost/asio/detail/op_queue.hpp>
#include <boost/asio/detail/reactor_fwd.hpp>
#include <boost/asio/detail/scheduler_operation.hpp>
+#include <boost/asio/detail/thread.hpp>
#include <boost/asio/detail/thread_context.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -45,7 +46,10 @@ public:
// Constructor. Specifies the number of concurrent threads that are likely to
// run the scheduler. If set to 1 certain optimisation are performed.
BOOST_ASIO_DECL scheduler(boost::asio::execution_context& ctx,
- int concurrency_hint = 0);
+ int concurrency_hint = 0, bool own_thread = true);
+
+ // Destructor.
+ BOOST_ASIO_DECL ~scheduler();
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -157,6 +161,10 @@ private:
BOOST_ASIO_DECL void wake_one_thread_and_unlock(
mutex::scoped_lock& lock);
+ // Helper class to run the scheduler in its own thread.
+ class thread_function;
+ friend class thread_function;
+
// Helper class to perform task-related operations on block exit.
struct task_cleanup;
friend struct task_cleanup;
@@ -200,6 +208,9 @@ private:
// The concurrency hint used to initialise the scheduler.
const int concurrency_hint_;
+
+ // The thread that is running the scheduler.
+ boost::asio::detail::thread* thread_;
};
} // namespace detail
diff --git a/boost/asio/detail/scheduler_operation.hpp b/boost/asio/detail/scheduler_operation.hpp
index 633a8c594f..df6237f48c 100644
--- a/boost/asio/detail/scheduler_operation.hpp
+++ b/boost/asio/detail/scheduler_operation.hpp
@@ -2,7 +2,7 @@
// detail/scheduler_operation.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/scheduler_thread_info.hpp b/boost/asio/detail/scheduler_thread_info.hpp
index 5f18381d50..f9b556ab8f 100644
--- a/boost/asio/detail/scheduler_thread_info.hpp
+++ b/boost/asio/detail/scheduler_thread_info.hpp
@@ -2,7 +2,7 @@
// detail/scheduler_thread_info.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/scoped_lock.hpp b/boost/asio/detail/scoped_lock.hpp
index 005585c700..74239297ed 100644
--- a/boost/asio/detail/scoped_lock.hpp
+++ b/boost/asio/detail/scoped_lock.hpp
@@ -2,7 +2,7 @@
// detail/scoped_lock.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/scoped_ptr.hpp b/boost/asio/detail/scoped_ptr.hpp
index 12ad834919..707be722f3 100644
--- a/boost/asio/detail/scoped_ptr.hpp
+++ b/boost/asio/detail/scoped_ptr.hpp
@@ -2,7 +2,7 @@
// detail/scoped_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/select_interrupter.hpp b/boost/asio/detail/select_interrupter.hpp
index d837634e89..0c2dd91216 100644
--- a/boost/asio/detail/select_interrupter.hpp
+++ b/boost/asio/detail/select_interrupter.hpp
@@ -2,7 +2,7 @@
// detail/select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/select_reactor.hpp b/boost/asio/detail/select_reactor.hpp
index dfb5e96943..435ce0463f 100644
--- a/boost/asio/detail/select_reactor.hpp
+++ b/boost/asio/detail/select_reactor.hpp
@@ -2,7 +2,7 @@
// detail/select_reactor.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/service_registry.hpp b/boost/asio/detail/service_registry.hpp
index 894fdb1b75..35140efef1 100644
--- a/boost/asio/detail/service_registry.hpp
+++ b/boost/asio/detail/service_registry.hpp
@@ -2,7 +2,7 @@
// detail/service_registry.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/signal_blocker.hpp b/boost/asio/detail/signal_blocker.hpp
index 875f188f48..9f5b6f5225 100644
--- a/boost/asio/detail/signal_blocker.hpp
+++ b/boost/asio/detail/signal_blocker.hpp
@@ -2,7 +2,7 @@
// detail/signal_blocker.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/signal_handler.hpp b/boost/asio/detail/signal_handler.hpp
index 2045db2188..3796c3b63a 100644
--- a/boost/asio/detail/signal_handler.hpp
+++ b/boost/asio/detail/signal_handler.hpp
@@ -2,7 +2,7 @@
// detail/signal_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -30,17 +30,18 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class signal_handler : public signal_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler);
- signal_handler(Handler& h)
+ signal_handler(Handler& h, const IoExecutor& io_ex)
: signal_op(&signal_handler::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -50,7 +51,7 @@ public:
// Take ownership of the handler object.
signal_handler* h(static_cast<signal_handler*>(base));
ptr p = { boost::asio::detail::addressof(h->handler_), h, h };
- handler_work<Handler> w(h->handler_);
+ handler_work<Handler, IoExecutor> w(h->handler_, h->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*h));
@@ -77,6 +78,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/signal_init.hpp b/boost/asio/detail/signal_init.hpp
index 1889de689b..9fb87e5987 100644
--- a/boost/asio/detail/signal_init.hpp
+++ b/boost/asio/detail/signal_init.hpp
@@ -2,7 +2,7 @@
// detail/signal_init.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/signal_op.hpp b/boost/asio/detail/signal_op.hpp
index 74cc68290d..d7719f4cfd 100644
--- a/boost/asio/detail/signal_op.hpp
+++ b/boost/asio/detail/signal_op.hpp
@@ -2,7 +2,7 @@
// detail/signal_op.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/signal_set_service.hpp b/boost/asio/detail/signal_set_service.hpp
index 17ae44ea37..baaf856349 100644
--- a/boost/asio/detail/signal_set_service.hpp
+++ b/boost/asio/detail/signal_set_service.hpp
@@ -2,7 +2,7 @@
// detail/signal_set_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -20,7 +20,7 @@
#include <cstddef>
#include <signal.h>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/op_queue.hpp>
@@ -28,6 +28,12 @@
#include <boost/asio/detail/signal_op.hpp>
#include <boost/asio/detail/socket_types.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#if !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
# include <boost/asio/detail/reactor.hpp>
#endif // !defined(BOOST_ASIO_WINDOWS) && !defined(__CYGWIN__)
@@ -49,7 +55,7 @@ extern BOOST_ASIO_DECL struct signal_state* get_signal_state();
extern "C" BOOST_ASIO_DECL void boost_asio_signal_handler(int signal_number);
class signal_set_service :
- public service_base<signal_set_service>
+ public execution_context_service_base<signal_set_service>
{
public:
// Type used for tracking an individual signal registration.
@@ -110,7 +116,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL signal_set_service(boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL signal_set_service(execution_context& context);
// Destructor.
BOOST_ASIO_DECL ~signal_set_service();
@@ -120,7 +126,7 @@ public:
// Perform fork-related housekeeping.
BOOST_ASIO_DECL void notify_fork(
- boost::asio::io_context::fork_event fork_ev);
+ boost::asio::execution_context::fork_event fork_ev);
// Construct a new signal_set implementation.
BOOST_ASIO_DECL void construct(implementation_type& impl);
@@ -145,16 +151,17 @@ public:
boost::system::error_code& ec);
// Start an asynchronous operation to wait for a signal to be delivered.
- template <typename Handler>
- void async_wait(implementation_type& impl, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_wait(implementation_type& impl,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef signal_handler<Handler> op;
+ typedef signal_handler<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "signal_set", &impl, 0, "async_wait"));
start_wait_op(impl, p.p);
@@ -180,8 +187,13 @@ private:
// Helper function to start a wait operation.
BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op);
- // The io_context instance used for dispatching handlers.
- io_context_impl& io_context_;
+ // The scheduler used for dispatching handlers.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
#if !defined(BOOST_ASIO_WINDOWS) \
&& !defined(BOOST_ASIO_WINDOWS_RUNTIME) \
diff --git a/boost/asio/detail/socket_holder.hpp b/boost/asio/detail/socket_holder.hpp
index b229f66b1b..c96e98297c 100644
--- a/boost/asio/detail/socket_holder.hpp
+++ b/boost/asio/detail/socket_holder.hpp
@@ -2,7 +2,7 @@
// detail/socket_holder.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/socket_ops.hpp b/boost/asio/detail/socket_ops.hpp
index 8f5fa0b3ca..506a06d776 100644
--- a/boost/asio/detail/socket_ops.hpp
+++ b/boost/asio/detail/socket_ops.hpp
@@ -2,7 +2,7 @@
// detail/socket_ops.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/socket_option.hpp b/boost/asio/detail/socket_option.hpp
index bd940142ca..8a77b1229b 100644
--- a/boost/asio/detail/socket_option.hpp
+++ b/boost/asio/detail/socket_option.hpp
@@ -2,7 +2,7 @@
// detail/socket_option.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/socket_select_interrupter.hpp b/boost/asio/detail/socket_select_interrupter.hpp
index dc7e30d69b..fc812701d7 100644
--- a/boost/asio/detail/socket_select_interrupter.hpp
+++ b/boost/asio/detail/socket_select_interrupter.hpp
@@ -2,7 +2,7 @@
// detail/socket_select_interrupter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/socket_types.hpp b/boost/asio/detail/socket_types.hpp
index 11ed551838..867caa5845 100644
--- a/boost/asio/detail/socket_types.hpp
+++ b/boost/asio/detail/socket_types.hpp
@@ -2,7 +2,7 @@
// detail/socket_types.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/solaris_fenced_block.hpp b/boost/asio/detail/solaris_fenced_block.hpp
index 3b605daf39..aa7fca3303 100644
--- a/boost/asio/detail/solaris_fenced_block.hpp
+++ b/boost/asio/detail/solaris_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/solaris_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/static_mutex.hpp b/boost/asio/detail/static_mutex.hpp
index 1bc5c2c813..b6194e400d 100644
--- a/boost/asio/detail/static_mutex.hpp
+++ b/boost/asio/detail/static_mutex.hpp
@@ -2,7 +2,7 @@
// detail/static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_event.hpp b/boost/asio/detail/std_event.hpp
index d32bff422e..9532ec9f95 100644
--- a/boost/asio/detail/std_event.hpp
+++ b/boost/asio/detail/std_event.hpp
@@ -2,7 +2,7 @@
// detail/std_event.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_fenced_block.hpp b/boost/asio/detail/std_fenced_block.hpp
index 3993199145..2d87752079 100644
--- a/boost/asio/detail/std_fenced_block.hpp
+++ b/boost/asio/detail/std_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/std_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_global.hpp b/boost/asio/detail/std_global.hpp
index f9df646bc6..1c19afe13c 100644
--- a/boost/asio/detail/std_global.hpp
+++ b/boost/asio/detail/std_global.hpp
@@ -2,7 +2,7 @@
// detail/std_global.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_mutex.hpp b/boost/asio/detail/std_mutex.hpp
index 463735b92a..7bd17cb00f 100644
--- a/boost/asio/detail/std_mutex.hpp
+++ b/boost/asio/detail/std_mutex.hpp
@@ -2,7 +2,7 @@
// detail/std_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_static_mutex.hpp b/boost/asio/detail/std_static_mutex.hpp
index 16104bcfa6..9b0581ee59 100644
--- a/boost/asio/detail/std_static_mutex.hpp
+++ b/boost/asio/detail/std_static_mutex.hpp
@@ -2,7 +2,7 @@
// detail/std_static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/std_thread.hpp b/boost/asio/detail/std_thread.hpp
index af507ed32f..314a06cae5 100644
--- a/boost/asio/detail/std_thread.hpp
+++ b/boost/asio/detail/std_thread.hpp
@@ -2,7 +2,7 @@
// detail/std_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/strand_executor_service.hpp b/boost/asio/detail/strand_executor_service.hpp
index c3e68408dc..4fc9327ecd 100644
--- a/boost/asio/detail/strand_executor_service.hpp
+++ b/boost/asio/detail/strand_executor_service.hpp
@@ -2,7 +2,7 @@
// detail/strand_executor_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/strand_service.hpp b/boost/asio/detail/strand_service.hpp
index f036264b95..14271c4e4e 100644
--- a/boost/asio/detail/strand_service.hpp
+++ b/boost/asio/detail/strand_service.hpp
@@ -2,7 +2,7 @@
// detail/strand_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/string_view.hpp b/boost/asio/detail/string_view.hpp
index f74d730c0b..07080c1e7c 100644
--- a/boost/asio/detail/string_view.hpp
+++ b/boost/asio/detail/string_view.hpp
@@ -2,7 +2,7 @@
// detail/string_view.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/thread.hpp b/boost/asio/detail/thread.hpp
index 41810c6477..a888d52dd2 100644
--- a/boost/asio/detail/thread.hpp
+++ b/boost/asio/detail/thread.hpp
@@ -2,7 +2,7 @@
// detail/thread.hpp
// ~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/thread_context.hpp b/boost/asio/detail/thread_context.hpp
index b4a2435f0f..2005a0d76b 100644
--- a/boost/asio/detail/thread_context.hpp
+++ b/boost/asio/detail/thread_context.hpp
@@ -2,7 +2,7 @@
// detail/thread_context.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/thread_group.hpp b/boost/asio/detail/thread_group.hpp
index c9c194142f..c6a4a99773 100644
--- a/boost/asio/detail/thread_group.hpp
+++ b/boost/asio/detail/thread_group.hpp
@@ -2,7 +2,7 @@
// detail/thread_group.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -65,6 +65,12 @@ public:
}
}
+ // Test whether the group is empty.
+ bool empty() const
+ {
+ return first_ == 0;
+ }
+
private:
// Structure used to track a single thread in the group.
struct item
diff --git a/boost/asio/detail/thread_info_base.hpp b/boost/asio/detail/thread_info_base.hpp
index 16bb1787f3..6b7a20c5ed 100644
--- a/boost/asio/detail/thread_info_base.hpp
+++ b/boost/asio/detail/thread_info_base.hpp
@@ -2,7 +2,7 @@
// detail/thread_info_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -34,11 +34,16 @@ public:
enum { mem_index = 0 };
};
- struct awaitee_tag
+ struct awaitable_frame_tag
{
enum { mem_index = 1 };
};
+ struct executor_function_tag
+ {
+ enum { mem_index = 2 };
+ };
+
thread_info_base()
{
for (int i = 0; i < max_mem_index; ++i)
@@ -110,7 +115,7 @@ public:
private:
enum { chunk_size = 4 };
- enum { max_mem_index = 2 };
+ enum { max_mem_index = 3 };
void* reusable_memory_[max_mem_index];
};
diff --git a/boost/asio/detail/throw_error.hpp b/boost/asio/detail/throw_error.hpp
index c1775b2536..d31c859876 100644
--- a/boost/asio/detail/throw_error.hpp
+++ b/boost/asio/detail/throw_error.hpp
@@ -2,7 +2,7 @@
// detail/throw_error.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/throw_exception.hpp b/boost/asio/detail/throw_exception.hpp
index 8690fa6f63..6190419f55 100644
--- a/boost/asio/detail/throw_exception.hpp
+++ b/boost/asio/detail/throw_exception.hpp
@@ -2,7 +2,7 @@
// detail/throw_exception.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_queue.hpp b/boost/asio/detail/timer_queue.hpp
index 3b2bcff774..9ce6995b73 100644
--- a/boost/asio/detail/timer_queue.hpp
+++ b/boost/asio/detail/timer_queue.hpp
@@ -2,7 +2,7 @@
// detail/timer_queue.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_queue_base.hpp b/boost/asio/detail/timer_queue_base.hpp
index f3a14238aa..c95a2a520c 100644
--- a/boost/asio/detail/timer_queue_base.hpp
+++ b/boost/asio/detail/timer_queue_base.hpp
@@ -2,7 +2,7 @@
// detail/timer_queue_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_queue_ptime.hpp b/boost/asio/detail/timer_queue_ptime.hpp
index cc053bff9d..d803befb9f 100644
--- a/boost/asio/detail/timer_queue_ptime.hpp
+++ b/boost/asio/detail/timer_queue_ptime.hpp
@@ -2,7 +2,7 @@
// detail/timer_queue_ptime.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_queue_set.hpp b/boost/asio/detail/timer_queue_set.hpp
index 2bed122fc2..9b25e20892 100644
--- a/boost/asio/detail/timer_queue_set.hpp
+++ b/boost/asio/detail/timer_queue_set.hpp
@@ -2,7 +2,7 @@
// detail/timer_queue_set.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_scheduler.hpp b/boost/asio/detail/timer_scheduler.hpp
index dc6e8d890c..9d68a602c4 100644
--- a/boost/asio/detail/timer_scheduler.hpp
+++ b/boost/asio/detail/timer_scheduler.hpp
@@ -2,7 +2,7 @@
// detail/timer_scheduler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/timer_scheduler_fwd.hpp b/boost/asio/detail/timer_scheduler_fwd.hpp
index c3656c66a0..0675edf83a 100644
--- a/boost/asio/detail/timer_scheduler_fwd.hpp
+++ b/boost/asio/detail/timer_scheduler_fwd.hpp
@@ -2,7 +2,7 @@
// detail/timer_scheduler_fwd.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/tss_ptr.hpp b/boost/asio/detail/tss_ptr.hpp
index 7850718a3c..a7c87d2103 100644
--- a/boost/asio/detail/tss_ptr.hpp
+++ b/boost/asio/detail/tss_ptr.hpp
@@ -2,7 +2,7 @@
// detail/tss_ptr.hpp
// ~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/type_traits.hpp b/boost/asio/detail/type_traits.hpp
index a0d4cb4902..c53a7e745c 100644
--- a/boost/asio/detail/type_traits.hpp
+++ b/boost/asio/detail/type_traits.hpp
@@ -2,7 +2,7 @@
// detail/type_traits.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/variadic_templates.hpp b/boost/asio/detail/variadic_templates.hpp
index c358feec18..f552b4b026 100644
--- a/boost/asio/detail/variadic_templates.hpp
+++ b/boost/asio/detail/variadic_templates.hpp
@@ -2,7 +2,7 @@
// detail/variadic_templates.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -58,6 +58,20 @@
# define BOOST_ASIO_VARIADIC_BYVAL_ARGS_4 x1, x2, x3, x4
# define BOOST_ASIO_VARIADIC_BYVAL_ARGS_5 x1, x2, x3, x4, x5
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS(n) \
+ BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_##n
+
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_1 \
+ const T1& x1
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_2 \
+ const T1& x1, const T2& x2
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_3 \
+ const T1& x1, const T2& x2, const T3& x3
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_4 \
+ const T1& x1, const T2& x2, const T3& x3, const T4& x4
+# define BOOST_ASIO_VARIADIC_CONSTREF_PARAMS_5 \
+ const T1& x1, const T2& x2, const T3& x3, const T4& x4, const T5& x5
+
# define BOOST_ASIO_VARIADIC_MOVE_PARAMS(n) \
BOOST_ASIO_VARIADIC_MOVE_PARAMS_##n
diff --git a/boost/asio/detail/wait_handler.hpp b/boost/asio/detail/wait_handler.hpp
index a9341244f8..b94773467e 100644
--- a/boost/asio/detail/wait_handler.hpp
+++ b/boost/asio/detail/wait_handler.hpp
@@ -2,7 +2,7 @@
// detail/wait_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -19,9 +19,9 @@
#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/handler_work.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/wait_op.hpp>
-#include <boost/asio/io_context.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -29,17 +29,18 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class wait_handler : public wait_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler);
- wait_handler(Handler& h)
+ wait_handler(Handler& h, const IoExecutor& ex)
: wait_op(&wait_handler::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(h))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)),
+ io_executor_(ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -49,7 +50,7 @@ public:
// Take ownership of the handler object.
wait_handler* h(static_cast<wait_handler*>(base));
ptr p = { boost::asio::detail::addressof(h->handler_), h, h };
- handler_work<Handler> w(h->handler_);
+ handler_work<Handler, IoExecutor> w(h->handler_, h->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*h));
@@ -76,6 +77,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/wait_op.hpp b/boost/asio/detail/wait_op.hpp
index 3a95a37580..a6b88f6e35 100644
--- a/boost/asio/detail/wait_op.hpp
+++ b/boost/asio/detail/wait_op.hpp
@@ -2,7 +2,7 @@
// detail/wait_op.hpp
// ~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_event.hpp b/boost/asio/detail/win_event.hpp
index 67edbcfb89..08de010af4 100644
--- a/boost/asio/detail/win_event.hpp
+++ b/boost/asio/detail/win_event.hpp
@@ -2,7 +2,7 @@
// detail/win_event.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_fd_set_adapter.hpp b/boost/asio/detail/win_fd_set_adapter.hpp
index bdddb32a9d..3f66d4af33 100644
--- a/boost/asio/detail/win_fd_set_adapter.hpp
+++ b/boost/asio/detail/win_fd_set_adapter.hpp
@@ -2,7 +2,7 @@
// detail/win_fd_set_adapter.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_fenced_block.hpp b/boost/asio/detail/win_fenced_block.hpp
index c595eaa00f..42aee2d774 100644
--- a/boost/asio/detail/win_fenced_block.hpp
+++ b/boost/asio/detail/win_fenced_block.hpp
@@ -2,7 +2,7 @@
// detail/win_fenced_block.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_global.hpp b/boost/asio/detail/win_global.hpp
index 11204dec6d..1165579baa 100644
--- a/boost/asio/detail/win_global.hpp
+++ b/boost/asio/detail/win_global.hpp
@@ -2,7 +2,7 @@
// detail/win_global.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -36,7 +36,7 @@ struct win_global_impl
static win_global_impl instance_;
static static_mutex mutex_;
- static T* ptr_;
+ T* ptr_;
static tss_ptr<T> tss_ptr_;
};
@@ -47,9 +47,6 @@ template <typename T>
static_mutex win_global_impl<T>::mutex_ = BOOST_ASIO_STATIC_MUTEX_INIT;
template <typename T>
-T* win_global_impl<T>::ptr_ = 0;
-
-template <typename T>
tss_ptr<T> win_global_impl<T>::tss_ptr_;
template <typename T>
@@ -59,9 +56,9 @@ T& win_global()
{
win_global_impl<T>::mutex_.init();
static_mutex::scoped_lock lock(win_global_impl<T>::mutex_);
- if (win_global_impl<T>::ptr_ == 0)
- win_global_impl<T>::ptr_ = new T;
- win_global_impl<T>::tss_ptr_ = win_global_impl<T>::ptr_;
+ if (win_global_impl<T>::instance_.ptr_ == 0)
+ win_global_impl<T>::instance_.ptr_ = new T;
+ win_global_impl<T>::tss_ptr_ = win_global_impl<T>::instance_.ptr_;
}
return *win_global_impl<T>::tss_ptr_;
diff --git a/boost/asio/detail/win_iocp_handle_read_op.hpp b/boost/asio/detail/win_iocp_handle_read_op.hpp
index 842ed80b73..04675ab9a4 100644
--- a/boost/asio/detail/win_iocp_handle_read_op.hpp
+++ b/boost/asio/detail/win_iocp_handle_read_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_handle_read_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -35,19 +35,20 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class win_iocp_handle_read_op : public operation
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_read_op);
- win_iocp_handle_read_op(
- const MutableBufferSequence& buffers, Handler& handler)
+ win_iocp_handle_read_op(const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_handle_read_op::do_complete),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -59,7 +60,7 @@ public:
// Take ownership of the operation object.
win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -100,6 +101,7 @@ public:
private:
MutableBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_handle_service.hpp b/boost/asio/detail/win_iocp_handle_service.hpp
index 4d5aadeef5..92aa8e88ca 100644
--- a/boost/asio/detail/win_iocp_handle_service.hpp
+++ b/boost/asio/detail/win_iocp_handle_service.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_handle_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -21,7 +21,7 @@
#if defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/cstdint.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
@@ -39,7 +39,7 @@ namespace asio {
namespace detail {
class win_iocp_handle_service :
- public service_base<win_iocp_handle_service>
+ public execution_context_service_base<win_iocp_handle_service>
{
public:
// The native type of a stream handle.
@@ -76,7 +76,7 @@ public:
implementation_type* prev_;
};
- BOOST_ASIO_DECL win_iocp_handle_service(boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL win_iocp_handle_service(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -143,15 +143,17 @@ public:
// Start an asynchronous write. The data being written must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op;
+ typedef win_iocp_handle_write_op<
+ ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some"));
@@ -164,15 +166,17 @@ public:
// Start an asynchronous write at a specified offset. The data being written
// must be valid for the lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
- void async_write_some_at(implementation_type& impl, uint64_t offset,
- const ConstBufferSequence& buffers, Handler& handler)
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
+ void async_write_some_at(implementation_type& impl,
+ uint64_t offset, const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op;
+ typedef win_iocp_handle_write_op<
+ ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
reinterpret_cast<uintmax_t>(impl.handle_), "async_write_some_at"));
@@ -205,15 +209,18 @@ public:
// Start an asynchronous read. The buffer for the data being received must be
// valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op;
+ typedef win_iocp_handle_read_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some"));
@@ -227,15 +234,18 @@ public:
// Start an asynchronous read at a specified offset. The buffer for the data
// being received must be valid for the lifetime of the asynchronous
// operation.
- template <typename MutableBufferSequence, typename Handler>
- void async_read_some_at(implementation_type& impl, uint64_t offset,
- const MutableBufferSequence& buffers, Handler& handler)
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
+ void async_read_some_at(implementation_type& impl,
+ uint64_t offset, const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op;
+ typedef win_iocp_handle_read_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
BOOST_ASIO_HANDLER_CREATION((iocp_service_.context(), *p.p, "handle", &impl,
reinterpret_cast<uintmax_t>(impl.handle_), "async_read_some_at"));
@@ -252,22 +262,24 @@ private:
const null_buffers& buffers, boost::system::error_code& ec);
size_t write_some_at(implementation_type& impl, uint64_t offset,
const null_buffers& buffers, boost::system::error_code& ec);
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const null_buffers& buffers, Handler& handler);
- template <typename Handler>
+ const null_buffers& buffers, Handler& handler,
+ const IoExecutor& io_ex);
+ template <typename Handler, typename IoExecutor>
void async_write_some_at(implementation_type& impl, uint64_t offset,
- const null_buffers& buffers, Handler& handler);
+ const null_buffers& buffers, Handler& handler, const IoExecutor& io_ex);
size_t read_some(implementation_type& impl,
const null_buffers& buffers, boost::system::error_code& ec);
size_t read_some_at(implementation_type& impl, uint64_t offset,
const null_buffers& buffers, boost::system::error_code& ec);
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const null_buffers& buffers, Handler& handler);
- template <typename Handler>
+ const null_buffers& buffers, Handler& handler,
+ const IoExecutor& io_ex);
+ template <typename Handler, typename IoExecutor>
void async_read_some_at(implementation_type& impl, uint64_t offset,
- const null_buffers& buffers, Handler& handler);
+ const null_buffers& buffers, Handler& handler, const IoExecutor& io_ex);
// Helper class for waiting for synchronous operations to complete.
class overlapped_wrapper;
diff --git a/boost/asio/detail/win_iocp_handle_write_op.hpp b/boost/asio/detail/win_iocp_handle_write_op.hpp
index 582b3f2b82..7e81eb843b 100644
--- a/boost/asio/detail/win_iocp_handle_write_op.hpp
+++ b/boost/asio/detail/win_iocp_handle_write_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_handle_write_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -35,18 +35,20 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename ConstBufferSequence, typename Handler>
+template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
class win_iocp_handle_write_op : public operation
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_write_op);
- win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler& handler)
+ win_iocp_handle_write_op(const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_handle_write_op::do_complete),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -55,7 +57,7 @@ public:
// Take ownership of the operation object.
win_iocp_handle_write_op* o(static_cast<win_iocp_handle_write_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -92,6 +94,7 @@ public:
private:
ConstBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_io_context.hpp b/boost/asio/detail/win_iocp_io_context.hpp
index 1ccdf35f65..d551b9b27f 100644
--- a/boost/asio/detail/win_iocp_io_context.hpp
+++ b/boost/asio/detail/win_iocp_io_context.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_io_context.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -49,7 +49,10 @@ public:
// Constructor. Specifies a concurrency hint that is passed through to the
// underlying I/O completion port.
BOOST_ASIO_DECL win_iocp_io_context(boost::asio::execution_context& ctx,
- int concurrency_hint = -1);
+ int concurrency_hint = -1, bool own_thread = true);
+
+ // Destructor.
+ BOOST_ASIO_DECL ~win_iocp_io_context();
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -288,6 +291,10 @@ private:
// Timeout to use with GetQueuedCompletionStatus.
const DWORD gqcs_timeout_;
+ // Helper class to run the scheduler in its own thread.
+ struct thread_function;
+ friend struct thread_function;
+
// Function object for processing timeouts in a background thread.
struct timer_thread_function;
friend struct timer_thread_function;
@@ -312,6 +319,9 @@ private:
// The concurrency hint used to initialise the io_context.
const int concurrency_hint_;
+
+ // The thread that is running the io_context.
+ scoped_ptr<thread> thread_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_null_buffers_op.hpp b/boost/asio/detail/win_iocp_null_buffers_op.hpp
index 106bedeba0..c32163987f 100644
--- a/boost/asio/detail/win_iocp_null_buffers_op.hpp
+++ b/boost/asio/detail/win_iocp_null_buffers_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_null_buffers_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,20 +35,21 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class win_iocp_null_buffers_op : public reactor_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_null_buffers_op);
win_iocp_null_buffers_op(socket_ops::weak_cancel_token_type cancel_token,
- Handler& handler)
+ Handler& handler, const IoExecutor& io_ex)
: reactor_op(&win_iocp_null_buffers_op::do_perform,
&win_iocp_null_buffers_op::do_complete),
cancel_token_(cancel_token),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static status do_perform(reactor_op*)
@@ -65,7 +66,7 @@ public:
// Take ownership of the operation object.
win_iocp_null_buffers_op* o(static_cast<win_iocp_null_buffers_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -110,6 +111,7 @@ public:
private:
socket_ops::weak_cancel_token_type cancel_token_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_operation.hpp b/boost/asio/detail/win_iocp_operation.hpp
index 11111f3150..5cad6e338c 100644
--- a/boost/asio/detail/win_iocp_operation.hpp
+++ b/boost/asio/detail/win_iocp_operation.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_operation.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_iocp_overlapped_op.hpp b/boost/asio/detail/win_iocp_overlapped_op.hpp
index 18f0d63173..c36e764a11 100644
--- a/boost/asio/detail/win_iocp_overlapped_op.hpp
+++ b/boost/asio/detail/win_iocp_overlapped_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_overlapped_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -33,17 +33,18 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class win_iocp_overlapped_op : public operation
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_overlapped_op);
- win_iocp_overlapped_op(Handler& handler)
+ win_iocp_overlapped_op(Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_overlapped_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -52,7 +53,7 @@ public:
// Take ownership of the operation object.
win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -79,6 +80,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/boost/asio/detail/win_iocp_overlapped_ptr.hpp
index 6cff7ae1d4..d1ed1cb1a0 100644
--- a/boost/asio/detail/win_iocp_overlapped_ptr.hpp
+++ b/boost/asio/detail/win_iocp_overlapped_ptr.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_overlapped_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,6 +21,7 @@
#include <boost/asio/io_context.hpp>
#include <boost/asio/detail/handler_alloc_helpers.hpp>
+#include <boost/asio/detail/io_object_executor.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/noncopyable.hpp>
#include <boost/asio/detail/win_iocp_overlapped_op.hpp>
@@ -45,13 +46,13 @@ public:
}
// Construct an win_iocp_overlapped_ptr to contain the specified handler.
- template <typename Handler>
- explicit win_iocp_overlapped_ptr(
- boost::asio::io_context& io_context, BOOST_ASIO_MOVE_ARG(Handler) handler)
+ template <typename Executor, typename Handler>
+ explicit win_iocp_overlapped_ptr(const Executor& ex,
+ BOOST_ASIO_MOVE_ARG(Handler) handler)
: ptr_(0),
iocp_service_(0)
{
- this->reset(io_context, BOOST_ASIO_MOVE_CAST(Handler)(handler));
+ this->reset(ex, BOOST_ASIO_MOVE_CAST(Handler)(handler));
}
// Destructor automatically frees the OVERLAPPED object unless released.
@@ -74,22 +75,25 @@ public:
// Reset to contain the specified handler, freeing any current OVERLAPPED
// object.
- template <typename Handler>
- void reset(boost::asio::io_context& io_context, Handler handler)
+ template <typename Executor, typename Handler>
+ void reset(const Executor& ex, Handler handler)
{
- typedef win_iocp_overlapped_op<Handler> op;
+ const bool native = is_same<Executor, io_context::executor_type>::value;
+ win_iocp_io_context* iocp_service = this->get_iocp_service(ex);
+
+ typedef win_iocp_overlapped_op<Handler, io_object_executor<Executor> > op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_object_executor<Executor>(ex, native));
- BOOST_ASIO_HANDLER_CREATION((io_context, *p.p,
- "io_context", &io_context.impl_, 0, "overlapped"));
+ BOOST_ASIO_HANDLER_CREATION((ex.context(), *p.p,
+ "iocp_service", iocp_service, 0, "overlapped"));
- io_context.impl_.work_started();
+ iocp_service->work_started();
reset();
ptr_ = p.p;
p.v = p.p = 0;
- iocp_service_ = &io_context.impl_;
+ iocp_service_ = iocp_service;
}
// Get the contained OVERLAPPED object.
@@ -130,6 +134,18 @@ public:
}
private:
+ template <typename Executor>
+ static win_iocp_io_context* get_iocp_service(const Executor& ex)
+ {
+ return &use_service<win_iocp_io_context>(ex.context());
+ }
+
+ static win_iocp_io_context* get_iocp_service(
+ const io_context::executor_type& ex)
+ {
+ return &ex.context().impl_;
+ }
+
win_iocp_operation* ptr_;
win_iocp_io_context* iocp_service_;
};
diff --git a/boost/asio/detail/win_iocp_serial_port_service.hpp b/boost/asio/detail/win_iocp_serial_port_service.hpp
index 3da2537295..6f05d92fc1 100644
--- a/boost/asio/detail/win_iocp_serial_port_service.hpp
+++ b/boost/asio/detail/win_iocp_serial_port_service.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_serial_port_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -22,7 +22,7 @@
#include <string>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/win_iocp_handle_service.hpp>
#include <boost/asio/detail/push_options.hpp>
@@ -33,7 +33,7 @@ namespace detail {
// Extend win_iocp_handle_service to provide serial port support.
class win_iocp_serial_port_service :
- public service_base<win_iocp_serial_port_service>
+ public execution_context_service_base<win_iocp_serial_port_service>
{
public:
// The native type of a serial port.
@@ -43,8 +43,7 @@ public:
typedef win_iocp_handle_service::implementation_type implementation_type;
// Constructor.
- BOOST_ASIO_DECL win_iocp_serial_port_service(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL win_iocp_serial_port_service(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -152,11 +151,12 @@ public:
// Start an asynchronous write. The data being written must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_write_some(implementation_type& impl,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
- handle_service_.async_write_some(impl, buffers, handler);
+ handle_service_.async_write_some(impl, buffers, handler, io_ex);
}
// Read some data. Returns the number of bytes received.
@@ -169,11 +169,13 @@ public:
// Start an asynchronous read. The buffer for the data being received must be
// valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_read_some(implementation_type& impl,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
{
- handle_service_.async_read_some(impl, buffers, handler);
+ handle_service_.async_read_some(impl, buffers, handler, io_ex);
}
private:
diff --git a/boost/asio/detail/win_iocp_socket_accept_op.hpp b/boost/asio/detail/win_iocp_socket_accept_op.hpp
index 8e1b7fc93a..75dadc27c1 100644
--- a/boost/asio/detail/win_iocp_socket_accept_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_accept_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_accept_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -36,7 +36,8 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Socket, typename Protocol, typename Handler>
+template <typename Socket, typename Protocol,
+ typename Handler, typename IoExecutor>
class win_iocp_socket_accept_op : public operation
{
public:
@@ -45,7 +46,7 @@ public:
win_iocp_socket_accept_op(win_iocp_socket_service_base& socket_service,
socket_type socket, Socket& peer, const Protocol& protocol,
typename Protocol::endpoint* peer_endpoint,
- bool enable_connection_aborted, Handler& handler)
+ bool enable_connection_aborted, Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_socket_accept_op::do_complete),
socket_service_(socket_service),
socket_(socket),
@@ -53,9 +54,10 @@ public:
protocol_(protocol),
peer_endpoint_(peer_endpoint),
enable_connection_aborted_(enable_connection_aborted),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
socket_holder& new_socket()
@@ -82,7 +84,7 @@ public:
// Take ownership of the operation object.
win_iocp_socket_accept_op* o(static_cast<win_iocp_socket_accept_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
if (owner)
{
@@ -156,11 +158,13 @@ private:
unsigned char output_buffer_[(sizeof(sockaddr_storage_type) + 16) * 2];
bool enable_connection_aborted_;
Handler handler_;
+ IoExecutor io_executor_;
};
#if defined(BOOST_ASIO_HAS_MOVE)
-template <typename Protocol, typename Handler>
+template <typename Protocol, typename PeerIoExecutor,
+ typename Handler, typename IoExecutor>
class win_iocp_socket_move_accept_op : public operation
{
public:
@@ -168,19 +172,20 @@ public:
win_iocp_socket_move_accept_op(
win_iocp_socket_service_base& socket_service, socket_type socket,
- const Protocol& protocol, boost::asio::io_context& peer_io_context,
+ const Protocol& protocol, const PeerIoExecutor& peer_io_ex,
typename Protocol::endpoint* peer_endpoint,
- bool enable_connection_aborted, Handler& handler)
+ bool enable_connection_aborted, Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_socket_move_accept_op::do_complete),
socket_service_(socket_service),
socket_(socket),
- peer_(peer_io_context),
+ peer_(peer_io_ex),
protocol_(protocol),
peer_endpoint_(peer_endpoint),
enable_connection_aborted_(enable_connection_aborted),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
socket_holder& new_socket()
@@ -208,7 +213,7 @@ public:
win_iocp_socket_move_accept_op* o(
static_cast<win_iocp_socket_move_accept_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
if (owner)
{
@@ -258,9 +263,9 @@ public:
// to ensure that any owning sub-object remains valid until after we have
// deallocated the memory here.
detail::move_binder2<Handler,
- boost::system::error_code, typename Protocol::socket>
+ boost::system::error_code, peer_socket_type>
handler(0, BOOST_ASIO_MOVE_CAST(Handler)(o->handler_), ec,
- BOOST_ASIO_MOVE_CAST(typename Protocol::socket)(o->peer_));
+ BOOST_ASIO_MOVE_CAST(peer_socket_type)(o->peer_));
p.h = boost::asio::detail::addressof(handler.handler_);
p.reset();
@@ -275,15 +280,19 @@ public:
}
private:
+ typedef typename Protocol::socket::template
+ rebind_executor<PeerIoExecutor>::other peer_socket_type;
+
win_iocp_socket_service_base& socket_service_;
socket_type socket_;
socket_holder new_socket_;
- typename Protocol::socket peer_;
+ peer_socket_type peer_;
Protocol protocol_;
typename Protocol::endpoint* peer_endpoint_;
unsigned char output_buffer_[(sizeof(sockaddr_storage_type) + 16) * 2];
bool enable_connection_aborted_;
Handler handler_;
+ IoExecutor io_executor_;
};
#endif // defined(BOOST_ASIO_HAS_MOVE)
diff --git a/boost/asio/detail/win_iocp_socket_connect_op.hpp b/boost/asio/detail/win_iocp_socket_connect_op.hpp
index 916d22ee49..0041a059ab 100644
--- a/boost/asio/detail/win_iocp_socket_connect_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_connect_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_connect_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -57,18 +57,20 @@ public:
bool connect_ex_;
};
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class win_iocp_socket_connect_op : public win_iocp_socket_connect_op_base
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_connect_op);
- win_iocp_socket_connect_op(socket_type socket, Handler& handler)
+ win_iocp_socket_connect_op(socket_type socket,
+ Handler& handler, const IoExecutor& io_ex)
: win_iocp_socket_connect_op_base(socket,
&win_iocp_socket_connect_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -81,7 +83,7 @@ public:
win_iocp_socket_connect_op* o(
static_cast<win_iocp_socket_connect_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
if (owner)
{
@@ -116,6 +118,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_socket_recv_op.hpp b/boost/asio/detail/win_iocp_socket_recv_op.hpp
index b052ec236e..daa3ca24ec 100644
--- a/boost/asio/detail/win_iocp_socket_recv_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_recv_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_recv_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,7 +35,7 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class win_iocp_socket_recv_op : public operation
{
public:
@@ -43,14 +43,16 @@ public:
win_iocp_socket_recv_op(socket_ops::state_type state,
socket_ops::weak_cancel_token_type cancel_token,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler& handler,
+ const IoExecutor& io_ex)
: operation(&win_iocp_socket_recv_op::do_complete),
state_(state),
cancel_token_(cancel_token),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -62,7 +64,7 @@ public:
// Take ownership of the operation object.
win_iocp_socket_recv_op* o(static_cast<win_iocp_socket_recv_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -106,6 +108,7 @@ private:
socket_ops::weak_cancel_token_type cancel_token_;
MutableBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp b/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp
index a7338c8877..bfd469a3d0 100644
--- a/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_recvfrom_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,7 +35,8 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename MutableBufferSequence, typename Endpoint, typename Handler>
+template <typename MutableBufferSequence, typename Endpoint,
+ typename Handler, typename IoExecutor>
class win_iocp_socket_recvfrom_op : public operation
{
public:
@@ -43,15 +44,17 @@ public:
win_iocp_socket_recvfrom_op(Endpoint& endpoint,
socket_ops::weak_cancel_token_type cancel_token,
- const MutableBufferSequence& buffers, Handler& handler)
+ const MutableBufferSequence& buffers, Handler& handler,
+ const IoExecutor& io_ex)
: operation(&win_iocp_socket_recvfrom_op::do_complete),
endpoint_(endpoint),
endpoint_size_(static_cast<int>(endpoint.capacity())),
cancel_token_(cancel_token),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
int& endpoint_size()
@@ -69,7 +72,7 @@ public:
win_iocp_socket_recvfrom_op* o(
static_cast<win_iocp_socket_recvfrom_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -114,6 +117,7 @@ private:
socket_ops::weak_cancel_token_type cancel_token_;
MutableBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp b/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp
index 4a8313225d..73127dca80 100644
--- a/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_recvmsg_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -36,7 +36,7 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class win_iocp_socket_recvmsg_op : public operation
{
public:
@@ -45,14 +45,16 @@ public:
win_iocp_socket_recvmsg_op(
socket_ops::weak_cancel_token_type cancel_token,
const MutableBufferSequence& buffers,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags,
+ Handler& handler, const IoExecutor& io_ex)
: operation(&win_iocp_socket_recvmsg_op::do_complete),
cancel_token_(cancel_token),
buffers_(buffers),
out_flags_(out_flags),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -65,7 +67,7 @@ public:
win_iocp_socket_recvmsg_op* o(
static_cast<win_iocp_socket_recvmsg_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -107,6 +109,7 @@ private:
MutableBufferSequence buffers_;
socket_base::message_flags& out_flags_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_socket_send_op.hpp b/boost/asio/detail/win_iocp_socket_send_op.hpp
index 7dc9ab3175..5f1fc4ad8e 100644
--- a/boost/asio/detail/win_iocp_socket_send_op.hpp
+++ b/boost/asio/detail/win_iocp_socket_send_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_send_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,20 +35,22 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename ConstBufferSequence, typename Handler>
+template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
class win_iocp_socket_send_op : public operation
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_send_op);
win_iocp_socket_send_op(socket_ops::weak_cancel_token_type cancel_token,
- const ConstBufferSequence& buffers, Handler& handler)
+ const ConstBufferSequence& buffers, Handler& handler,
+ const IoExecutor& io_ex)
: operation(&win_iocp_socket_send_op::do_complete),
cancel_token_(cancel_token),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -60,7 +62,7 @@ public:
// Take ownership of the operation object.
win_iocp_socket_send_op* o(static_cast<win_iocp_socket_send_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -100,6 +102,7 @@ private:
socket_ops::weak_cancel_token_type cancel_token_;
ConstBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_iocp_socket_service.hpp b/boost/asio/detail/win_iocp_socket_service.hpp
index d71c6ee046..df2292a55e 100644
--- a/boost/asio/detail/win_iocp_socket_service.hpp
+++ b/boost/asio/detail/win_iocp_socket_service.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,7 +21,7 @@
#include <cstring>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
@@ -52,7 +52,7 @@ namespace detail {
template <typename Protocol>
class win_iocp_socket_service :
- public service_base<win_iocp_socket_service<Protocol> >,
+ public execution_context_service_base<win_iocp_socket_service<Protocol> >,
public win_iocp_socket_service_base
{
public:
@@ -130,9 +130,10 @@ public:
};
// Constructor.
- win_iocp_socket_service(boost::asio::io_context& io_context)
- : service_base<win_iocp_socket_service<Protocol> >(io_context),
- win_iocp_socket_service_base(io_context)
+ win_iocp_socket_service(execution_context& context)
+ : execution_context_service_base<
+ win_iocp_socket_service<Protocol> >(context),
+ win_iocp_socket_service_base(context)
{
}
@@ -324,18 +325,20 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send_to(implementation_type& impl,
const ConstBufferSequence& buffers, const endpoint_type& destination,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op;
+ typedef win_iocp_socket_send_op<
+ ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
+ p.p = new (p.v) op(impl.cancel_token_, buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_send_to"));
buffer_sequence_adapter<boost::asio::const_buffer,
@@ -348,17 +351,18 @@ public:
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send_to(implementation_type& impl, const null_buffers&,
- const endpoint_type&, socket_base::message_flags, Handler& handler)
+ const endpoint_type&, socket_base::message_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_null_buffers_op<Handler> op;
+ typedef win_iocp_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_send_to(null_buffers)"));
start_reactor_op(impl, select_reactor::write_op, p.p);
@@ -404,19 +408,22 @@ public:
// Start an asynchronous receive. The buffer for the data being received and
// the sender_endpoint object must both be valid for the lifetime of the
// asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive_from(implementation_type& impl,
const MutableBufferSequence& buffers, endpoint_type& sender_endp,
- socket_base::message_flags flags, Handler& handler)
+ socket_base::message_flags flags, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_recvfrom_op<
- MutableBufferSequence, endpoint_type, Handler> op;
+ typedef win_iocp_socket_recvfrom_op<MutableBufferSequence,
+ endpoint_type, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler);
+ p.p = new (p.v) op(sender_endp, impl.cancel_token_,
+ buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive_from"));
buffer_sequence_adapter<boost::asio::mutable_buffer,
@@ -428,18 +435,18 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive_from(implementation_type& impl,
- const null_buffers&, endpoint_type& sender_endpoint,
- socket_base::message_flags flags, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive_from(implementation_type& impl, const null_buffers&,
+ endpoint_type& sender_endpoint, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_null_buffers_op<Handler> op;
+ typedef win_iocp_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive_from(null_buffers)"));
// Reset endpoint since it can be given no sensible value at this time.
@@ -479,50 +486,23 @@ public:
return ec;
}
-#if defined(BOOST_ASIO_HAS_MOVE)
- // Accept a new connection.
- typename Protocol::socket accept(implementation_type& impl,
- io_context* peer_io_context, endpoint_type* peer_endpoint,
- boost::system::error_code& ec)
- {
- typename Protocol::socket peer(
- peer_io_context ? *peer_io_context : io_context_);
-
- std::size_t addr_len = peer_endpoint ? peer_endpoint->capacity() : 0;
- socket_holder new_socket(socket_ops::sync_accept(impl.socket_,
- impl.state_, peer_endpoint ? peer_endpoint->data() : 0,
- peer_endpoint ? &addr_len : 0, ec));
-
- // On success, assign new connection to peer socket object.
- if (new_socket.get() != invalid_socket)
- {
- if (peer_endpoint)
- peer_endpoint->resize(addr_len);
- peer.assign(impl.protocol_, new_socket.get(), ec);
- if (!ec)
- new_socket.release();
- }
-
- return peer;
- }
-#endif // defined(BOOST_ASIO_HAS_MOVE)
-
// Start an asynchronous accept. The peer and peer_endpoint objects
// must be valid until the accept's handler is invoked.
- template <typename Socket, typename Handler>
+ template <typename Socket, typename Handler, typename IoExecutor>
void async_accept(implementation_type& impl, Socket& peer,
- endpoint_type* peer_endpoint, Handler& handler)
+ endpoint_type* peer_endpoint, Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_accept_op<Socket, protocol_type, Handler> op;
+ typedef win_iocp_socket_accept_op<Socket,
+ protocol_type, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
bool enable_connection_aborted =
(impl.state_ & socket_ops::enable_connection_aborted) != 0;
p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_,
- peer_endpoint, enable_connection_aborted, handler);
+ peer_endpoint, enable_connection_aborted, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_accept"));
start_accept_op(impl, peer.is_open(), p.p->new_socket(),
@@ -535,22 +515,23 @@ public:
#if defined(BOOST_ASIO_HAS_MOVE)
// Start an asynchronous accept. The peer and peer_endpoint objects
// must be valid until the accept's handler is invoked.
- template <typename Handler>
- void async_accept(implementation_type& impl,
- boost::asio::io_context* peer_io_context,
- endpoint_type* peer_endpoint, Handler& handler)
+ template <typename PeerIoExecutor, typename Handler, typename IoExecutor>
+ void async_move_accept(implementation_type& impl,
+ const PeerIoExecutor& peer_io_ex, endpoint_type* peer_endpoint,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_move_accept_op<protocol_type, Handler> op;
+ typedef win_iocp_socket_move_accept_op<
+ protocol_type, PeerIoExecutor, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
bool enable_connection_aborted =
(impl.state_ & socket_ops::enable_connection_aborted) != 0;
p.p = new (p.v) op(*this, impl.socket_, impl.protocol_,
- peer_io_context ? *peer_io_context : io_context_,
- peer_endpoint, enable_connection_aborted, handler);
+ peer_io_ex, peer_endpoint, enable_connection_aborted,
+ handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_accept"));
start_accept_op(impl, false, p.p->new_socket(),
@@ -571,17 +552,18 @@ public:
}
// Start an asynchronous connect.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
+ const endpoint_type& peer_endpoint, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_connect_op<Handler> op;
+ typedef win_iocp_socket_connect_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.socket_, handler);
+ p.p = new (p.v) op(impl.socket_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_connect"));
start_connect_op(impl, impl.protocol_.family(), impl.protocol_.type(),
diff --git a/boost/asio/detail/win_iocp_socket_service_base.hpp b/boost/asio/detail/win_iocp_socket_service_base.hpp
index dd2bf9f6a9..7a7c900be4 100644
--- a/boost/asio/detail/win_iocp_socket_service_base.hpp
+++ b/boost/asio/detail/win_iocp_socket_service_base.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_socket_service_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -20,7 +20,7 @@
#if defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
@@ -86,8 +86,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL win_iocp_socket_service_base(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL win_iocp_socket_service_base(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void base_shutdown();
@@ -211,20 +210,20 @@ public:
// Asynchronously wait for the socket to become ready to read, ready to
// write, or to have pending error conditions.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_wait(base_implementation_type& impl,
- socket_base::wait_type w, Handler& handler)
+ socket_base::wait_type w, Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_wait_op<Handler> op;
+ typedef win_iocp_wait_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_wait"));
switch (w)
@@ -272,18 +271,19 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send(base_implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const ConstBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_send_op<ConstBufferSequence, Handler> op;
+ typedef win_iocp_socket_send_op<
+ ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, buffers, handler);
+ p.p = new (p.v) op(impl.cancel_token_, buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_send"));
buffer_sequence_adapter<boost::asio::const_buffer,
@@ -296,17 +296,17 @@ public:
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_null_buffers_op<Handler> op;
+ typedef win_iocp_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_send(null_buffers)"));
start_reactor_op(impl, select_reactor::write_op, p.p);
@@ -338,18 +338,21 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const MutableBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_recv_op<MutableBufferSequence, Handler> op;
+ typedef win_iocp_socket_recv_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler);
+ p.p = new (p.v) op(impl.state_, impl.cancel_token_,
+ buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive"));
buffer_sequence_adapter<boost::asio::mutable_buffer,
@@ -362,17 +365,18 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
- void async_receive(base_implementation_type& impl, const null_buffers&,
- socket_base::message_flags flags, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_receive(base_implementation_type& impl,
+ const null_buffers&, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_null_buffers_op<Handler> op;
+ typedef win_iocp_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive(null_buffers)"));
start_null_buffers_receive_op(impl, flags, p.p);
@@ -411,18 +415,22 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive_with_flags(base_implementation_type& impl,
const MutableBufferSequence& buffers, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op;
+ typedef win_iocp_socket_recvmsg_op<
+ MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler);
+ p.p = new (p.v) op(impl.cancel_token_,
+ buffers, out_flags, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive_with_flags"));
buffer_sequence_adapter<boost::asio::mutable_buffer,
@@ -433,18 +441,19 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_receive_with_flags(base_implementation_type& impl,
const null_buffers&, socket_base::message_flags in_flags,
- socket_base::message_flags& out_flags, Handler& handler)
+ socket_base::message_flags& out_flags, Handler& handler,
+ const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef win_iocp_null_buffers_op<Handler> op;
+ typedef win_iocp_null_buffers_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(impl.cancel_token_, handler);
+ p.p = new (p.v) op(impl.cancel_token_, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_, *p.p, "socket",
+ BOOST_ASIO_HANDLER_CREATION((context_, *p.p, "socket",
&impl, impl.socket_, "async_receive_with_flags(null_buffers)"));
// Reset out_flags since it can be given no sensible value at this time.
@@ -519,8 +528,8 @@ protected:
base_implementation_type& impl);
// Helper function to get the reactor. If no reactor has been created yet, a
- // new one is obtained from the io_context and a pointer to it is cached in
- // this service.
+ // new one is obtained from the execution context and a pointer to it is
+ // cached in this service.
BOOST_ASIO_DECL select_reactor& get_reactor();
// The type of a ConnectEx function pointer, as old SDKs may not provide it.
@@ -554,8 +563,8 @@ protected:
// - platform SDKs where MSVC's /Wp64 option causes spurious warnings.
BOOST_ASIO_DECL void* interlocked_exchange_pointer(void** dest, void* val);
- // The io_context used to obtain the reactor, if required.
- boost::asio::io_context& io_context_;
+ // The execution context used to obtain the reactor, if required.
+ execution_context& context_;
// The IOCP service used for running asynchronous operations and dispatching
// handlers.
diff --git a/boost/asio/detail/win_iocp_thread_info.hpp b/boost/asio/detail/win_iocp_thread_info.hpp
index 53f853e104..c6819825c0 100644
--- a/boost/asio/detail/win_iocp_thread_info.hpp
+++ b/boost/asio/detail/win_iocp_thread_info.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_thread_info.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_iocp_wait_op.hpp b/boost/asio/detail/win_iocp_wait_op.hpp
index b067da3e3d..1f0929f99b 100644
--- a/boost/asio/detail/win_iocp_wait_op.hpp
+++ b/boost/asio/detail/win_iocp_wait_op.hpp
@@ -2,7 +2,7 @@
// detail/win_iocp_wait_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -35,20 +35,21 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class win_iocp_wait_op : public reactor_op
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_wait_op);
win_iocp_wait_op(socket_ops::weak_cancel_token_type cancel_token,
- Handler& handler)
+ Handler& handler, const IoExecutor& io_ex)
: reactor_op(&win_iocp_wait_op::do_perform,
&win_iocp_wait_op::do_complete),
cancel_token_(cancel_token),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static status do_perform(reactor_op*)
@@ -65,7 +66,7 @@ public:
// Take ownership of the operation object.
win_iocp_wait_op* o(static_cast<win_iocp_wait_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -110,6 +111,7 @@ public:
private:
socket_ops::weak_cancel_token_type cancel_token_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/win_mutex.hpp b/boost/asio/detail/win_mutex.hpp
index 45d87c63bb..7509131c4b 100644
--- a/boost/asio/detail/win_mutex.hpp
+++ b/boost/asio/detail/win_mutex.hpp
@@ -2,7 +2,7 @@
// detail/win_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_object_handle_service.hpp b/boost/asio/detail/win_object_handle_service.hpp
index 03fb634888..42032224a8 100644
--- a/boost/asio/detail/win_object_handle_service.hpp
+++ b/boost/asio/detail/win_object_handle_service.hpp
@@ -2,7 +2,7 @@
// detail/win_object_handle_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 Christopher M. Kohlhoff (chris at kohlhoff dot com)
// Copyright (c) 2011 Boris Schaeling (boris@highscore.de)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
@@ -24,7 +24,13 @@
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/wait_handler.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/detail/push_options.hpp>
@@ -33,7 +39,7 @@ namespace asio {
namespace detail {
class win_object_handle_service :
- public service_base<win_object_handle_service>
+ public execution_context_service_base<win_object_handle_service>
{
public:
// The native type of an object handle.
@@ -80,8 +86,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL win_object_handle_service(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL win_object_handle_service(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void shutdown();
@@ -130,16 +135,17 @@ public:
boost::system::error_code& ec);
/// Start an asynchronous wait.
- template <typename Handler>
- void async_wait(implementation_type& impl, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_wait(implementation_type& impl,
+ Handler& handler, const IoExecutor& io_ex)
{
// Allocate and construct an operation to wrap the handler.
- typedef wait_handler<Handler> op;
+ typedef wait_handler<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(), *p.p, "object_handle",
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(), *p.p, "object_handle",
&impl, reinterpret_cast<uintmax_t>(impl.wait_handle_), "async_wait"));
start_wait_op(impl, p.p);
@@ -158,8 +164,13 @@ private:
static BOOST_ASIO_DECL VOID CALLBACK wait_callback(
PVOID param, BOOLEAN timeout);
- // The io_context implementation used to post completions.
- io_context_impl& io_context_;
+ // The scheduler used to post completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
// Mutex to protect access to internal state.
mutex mutex_;
diff --git a/boost/asio/detail/win_static_mutex.hpp b/boost/asio/detail/win_static_mutex.hpp
index 78d3a2eb7f..c310d314db 100644
--- a/boost/asio/detail/win_static_mutex.hpp
+++ b/boost/asio/detail/win_static_mutex.hpp
@@ -2,7 +2,7 @@
// detail/win_static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_thread.hpp b/boost/asio/detail/win_thread.hpp
index 377c3e3f93..ef867448a9 100644
--- a/boost/asio/detail/win_thread.hpp
+++ b/boost/asio/detail/win_thread.hpp
@@ -2,7 +2,7 @@
// detail/win_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/win_tss_ptr.hpp b/boost/asio/detail/win_tss_ptr.hpp
index e1761c2e27..102b41a583 100644
--- a/boost/asio/detail/win_tss_ptr.hpp
+++ b/boost/asio/detail/win_tss_ptr.hpp
@@ -2,7 +2,7 @@
// detail/win_tss_ptr.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/winapp_thread.hpp b/boost/asio/detail/winapp_thread.hpp
index 775f663d84..b92c7f5a67 100644
--- a/boost/asio/detail/winapp_thread.hpp
+++ b/boost/asio/detail/winapp_thread.hpp
@@ -2,7 +2,7 @@
// detail/winapp_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/wince_thread.hpp b/boost/asio/detail/wince_thread.hpp
index 77ec7c8265..492a37c03f 100644
--- a/boost/asio/detail/wince_thread.hpp
+++ b/boost/asio/detail/wince_thread.hpp
@@ -2,7 +2,7 @@
// detail/wince_thread.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/winrt_async_manager.hpp b/boost/asio/detail/winrt_async_manager.hpp
index 57d6a1c218..e9dc6cb257 100644
--- a/boost/asio/detail/winrt_async_manager.hpp
+++ b/boost/asio/detail/winrt_async_manager.hpp
@@ -2,7 +2,7 @@
// detail/winrt_async_manager.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -23,7 +23,13 @@
#include <boost/asio/detail/atomic_count.hpp>
#include <boost/asio/detail/winrt_async_op.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/detail/push_options.hpp>
@@ -32,13 +38,13 @@ namespace asio {
namespace detail {
class winrt_async_manager
- : public boost::asio::detail::service_base<winrt_async_manager>
+ : public execution_context_service_base<winrt_async_manager>
{
public:
// Constructor.
- winrt_async_manager(boost::asio::io_context& io_context)
- : boost::asio::detail::service_base<winrt_async_manager>(io_context),
- io_context_(use_service<io_context_impl>(io_context)),
+ winrt_async_manager(execution_context& context)
+ : execution_context_service_base<winrt_async_manager>(context),
+ scheduler_(use_service<scheduler_impl>(context)),
outstanding_ops_(1)
{
}
@@ -186,12 +192,12 @@ public:
boost::system::system_category());
break;
}
- io_context_.post_deferred_completion(handler);
+ scheduler_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
- io_context_.work_started();
+ scheduler_.work_started();
++outstanding_ops_;
action->Completed = on_completed;
}
@@ -223,12 +229,12 @@ public:
boost::system::system_category());
break;
}
- io_context_.post_deferred_completion(handler);
+ scheduler_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
- io_context_.work_started();
+ scheduler_.work_started();
++outstanding_ops_;
operation->Completed = on_completed;
}
@@ -264,19 +270,24 @@ public:
boost::system::system_category());
break;
}
- io_context_.post_deferred_completion(handler);
+ scheduler_.post_deferred_completion(handler);
if (--outstanding_ops_ == 0)
promise_.set_value();
});
- io_context_.work_started();
+ scheduler_.work_started();
++outstanding_ops_;
operation->Completed = on_completed;
}
private:
- // The io_context implementation used to post completed handlers.
- io_context_impl& io_context_;
+ // The scheduler implementation used to post completed handlers.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
// Count of outstanding operations.
atomic_count outstanding_ops_;
diff --git a/boost/asio/detail/winrt_async_op.hpp b/boost/asio/detail/winrt_async_op.hpp
index c3203ff88a..251dd878e4 100644
--- a/boost/asio/detail/winrt_async_op.hpp
+++ b/boost/asio/detail/winrt_async_op.hpp
@@ -2,7 +2,7 @@
// detail/winrt_async_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/winrt_resolve_op.hpp b/boost/asio/detail/winrt_resolve_op.hpp
index 80f102f4c8..f7faa2993a 100644
--- a/boost/asio/detail/winrt_resolve_op.hpp
+++ b/boost/asio/detail/winrt_resolve_op.hpp
@@ -2,7 +2,7 @@
// detail/winrt_resolve_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -34,7 +34,7 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Protocol, typename Handler>
+template <typename Protocol, typename Handler, typename IoExecutor>
class winrt_resolve_op :
public winrt_async_op<
Windows::Foundation::Collections::IVectorView<
@@ -47,15 +47,17 @@ public:
typedef boost::asio::ip::basic_resolver_query<Protocol> query_type;
typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
- winrt_resolve_op(const query_type& query, Handler& handler)
+ winrt_resolve_op(const query_type& query,
+ Handler& handler, const IoExecutor& io_ex)
: winrt_async_op<
Windows::Foundation::Collections::IVectorView<
Windows::Networking::EndpointPair^>^>(
&winrt_resolve_op::do_complete),
query_(query),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -64,7 +66,7 @@ public:
// Take ownership of the operation object.
winrt_resolve_op* o(static_cast<winrt_resolve_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -107,6 +109,7 @@ public:
private:
query_type query_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/winrt_resolver_service.hpp b/boost/asio/detail/winrt_resolver_service.hpp
index 463dbde11f..054b6abfbc 100644
--- a/boost/asio/detail/winrt_resolver_service.hpp
+++ b/boost/asio/detail/winrt_resolver_service.hpp
@@ -2,7 +2,7 @@
// detail/winrt_resolver_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,6 +21,7 @@
#include <boost/asio/ip/basic_resolver_query.hpp>
#include <boost/asio/ip/basic_resolver_results.hpp>
+#include <boost/asio/post.hpp>
#include <boost/asio/detail/bind_handler.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/socket_ops.hpp>
@@ -28,6 +29,12 @@
#include <boost/asio/detail/winrt_resolve_op.hpp>
#include <boost/asio/detail/winrt_utils.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
@@ -36,7 +43,7 @@ namespace detail {
template <typename Protocol>
class winrt_resolver_service :
- public service_base<winrt_resolver_service<Protocol> >
+ public execution_context_service_base<winrt_resolver_service<Protocol> >
{
public:
// The implementation type of the resolver. A cancellation token is used to
@@ -54,10 +61,11 @@ public:
typedef boost::asio::ip::basic_resolver_results<Protocol> results_type;
// Constructor.
- winrt_resolver_service(boost::asio::io_context& io_context)
- : service_base<winrt_resolver_service<Protocol> >(io_context),
- io_context_(use_service<io_context_impl>(io_context)),
- async_manager_(use_service<winrt_async_manager>(io_context))
+ winrt_resolver_service(execution_context& context)
+ : execution_context_service_base<
+ winrt_resolver_service<Protocol> >(context),
+ scheduler_(use_service<scheduler_impl>(context)),
+ async_manager_(use_service<winrt_async_manager>(context))
{
}
@@ -72,7 +80,7 @@ public:
}
// Perform any fork-related housekeeping.
- void notify_fork(boost::asio::io_context::fork_event)
+ void notify_fork(execution_context::fork_event)
{
}
@@ -131,20 +139,20 @@ public:
}
// Asynchronously resolve a query to a list of entries.
- template <typename Handler>
- void async_resolve(implementation_type& impl,
- const query_type& query, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_resolve(implementation_type& impl, const query_type& query,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef winrt_resolve_op<Protocol, Handler> op;
+ typedef winrt_resolve_op<Protocol, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(query, handler);
+ p.p = new (p.v) op(query, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "resolver", &impl, 0, "async_resolve"));
(void)impl;
@@ -160,7 +168,7 @@ public:
{
p.p->ec_ = boost::system::error_code(
e->HResult, boost::system::system_category());
- io_context_.post_immediate_completion(p.p, is_continuation);
+ scheduler_.post_immediate_completion(p.p, is_continuation);
p.v = p.p = 0;
}
}
@@ -174,18 +182,24 @@ public:
}
// Asynchronously resolve an endpoint to a list of entries.
- template <typename Handler>
- void async_resolve(implementation_type&,
- const endpoint_type&, Handler& handler)
+ template <typename Handler, typename IoExecutor>
+ void async_resolve(implementation_type&, const endpoint_type&,
+ Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const results_type results;
- io_context_.get_io_context().post(
- detail::bind_handler(handler, ec, results));
+ boost::asio::post(io_ex, detail::bind_handler(handler, ec, results));
}
private:
- io_context_impl& io_context_;
+ // The scheduler implementation used for delivering completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
+
winrt_async_manager& async_manager_;
};
diff --git a/boost/asio/detail/winrt_socket_connect_op.hpp b/boost/asio/detail/winrt_socket_connect_op.hpp
index 9926da97d9..291c886086 100644
--- a/boost/asio/detail/winrt_socket_connect_op.hpp
+++ b/boost/asio/detail/winrt_socket_connect_op.hpp
@@ -2,7 +2,7 @@
// detail/winrt_socket_connect_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -34,18 +34,19 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename Handler>
+template <typename Handler, typename IoExecutor>
class winrt_socket_connect_op :
public winrt_async_op<void>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_connect_op);
- winrt_socket_connect_op(Handler& handler)
+ winrt_socket_connect_op(Handler& handler, const IoExecutor& io_ex)
: winrt_async_op<void>(&winrt_socket_connect_op::do_complete),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -54,7 +55,7 @@ public:
// Take ownership of the operation object.
winrt_socket_connect_op* o(static_cast<winrt_socket_connect_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -81,6 +82,7 @@ public:
private:
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/winrt_socket_recv_op.hpp b/boost/asio/detail/winrt_socket_recv_op.hpp
index 0701208da4..34a5a755bf 100644
--- a/boost/asio/detail/winrt_socket_recv_op.hpp
+++ b/boost/asio/detail/winrt_socket_recv_op.hpp
@@ -2,7 +2,7 @@
// detail/winrt_socket_recv_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -34,20 +34,22 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename MutableBufferSequence, typename Handler>
+template <typename MutableBufferSequence, typename Handler, typename IoExecutor>
class winrt_socket_recv_op :
public winrt_async_op<Windows::Storage::Streams::IBuffer^>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_recv_op);
- winrt_socket_recv_op(const MutableBufferSequence& buffers, Handler& handler)
+ winrt_socket_recv_op(const MutableBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: winrt_async_op<Windows::Storage::Streams::IBuffer^>(
&winrt_socket_recv_op::do_complete),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -56,7 +58,7 @@ public:
// Take ownership of the operation object.
winrt_socket_recv_op* o(static_cast<winrt_socket_recv_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -101,6 +103,7 @@ public:
private:
MutableBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/winrt_socket_send_op.hpp b/boost/asio/detail/winrt_socket_send_op.hpp
index 4e62056c4f..cbf42110f8 100644
--- a/boost/asio/detail/winrt_socket_send_op.hpp
+++ b/boost/asio/detail/winrt_socket_send_op.hpp
@@ -2,7 +2,7 @@
// detail/winrt_socket_send_op.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -34,19 +34,21 @@ namespace boost {
namespace asio {
namespace detail {
-template <typename ConstBufferSequence, typename Handler>
+template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
class winrt_socket_send_op :
public winrt_async_op<unsigned int>
{
public:
BOOST_ASIO_DEFINE_HANDLER_PTR(winrt_socket_send_op);
- winrt_socket_send_op(const ConstBufferSequence& buffers, Handler& handler)
+ winrt_socket_send_op(const ConstBufferSequence& buffers,
+ Handler& handler, const IoExecutor& io_ex)
: winrt_async_op<unsigned int>(&winrt_socket_send_op::do_complete),
buffers_(buffers),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)),
+ io_executor_(io_ex)
{
- handler_work<Handler>::start(handler_);
+ handler_work<Handler, IoExecutor>::start(handler_, io_executor_);
}
static void do_complete(void* owner, operation* base,
@@ -55,7 +57,7 @@ public:
// Take ownership of the operation object.
winrt_socket_send_op* o(static_cast<winrt_socket_send_op*>(base));
ptr p = { boost::asio::detail::addressof(o->handler_), o, o };
- handler_work<Handler> w(o->handler_);
+ handler_work<Handler, IoExecutor> w(o->handler_, o->io_executor_);
BOOST_ASIO_HANDLER_COMPLETION((*o));
@@ -92,6 +94,7 @@ public:
private:
ConstBufferSequence buffers_;
Handler handler_;
+ IoExecutor io_executor_;
};
} // namespace detail
diff --git a/boost/asio/detail/winrt_ssocket_service.hpp b/boost/asio/detail/winrt_ssocket_service.hpp
index c874f2520d..af2c718699 100644
--- a/boost/asio/detail/winrt_ssocket_service.hpp
+++ b/boost/asio/detail/winrt_ssocket_service.hpp
@@ -2,7 +2,7 @@
// detail/winrt_ssocket_service.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -20,7 +20,7 @@
#if defined(BOOST_ASIO_WINDOWS_RUNTIME)
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/detail/memory.hpp>
#include <boost/asio/detail/winrt_socket_connect_op.hpp>
#include <boost/asio/detail/winrt_ssocket_service_base.hpp>
@@ -34,7 +34,7 @@ namespace detail {
template <typename Protocol>
class winrt_ssocket_service :
- public service_base<winrt_ssocket_service<Protocol> >,
+ public execution_context_service_base<winrt_ssocket_service<Protocol> >,
public winrt_ssocket_service_base
{
public:
@@ -62,9 +62,9 @@ public:
};
// Constructor.
- winrt_ssocket_service(boost::asio::io_context& io_context)
- : service_base<winrt_ssocket_service<Protocol> >(io_context),
- winrt_ssocket_service_base(io_context)
+ winrt_ssocket_service(execution_context& context)
+ : execution_context_service_base<winrt_ssocket_service<Protocol> >(context),
+ winrt_ssocket_service_base(context)
{
}
@@ -211,20 +211,21 @@ public:
}
// Start an asynchronous connect.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_connect(implementation_type& impl,
- const endpoint_type& peer_endpoint, Handler& handler)
+ const endpoint_type& peer_endpoint,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef winrt_socket_connect_op<Handler> op;
+ typedef winrt_socket_connect_op<Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(handler);
+ p.p = new (p.v) op(handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "socket", &impl, 0, "async_connect"));
start_connect_op(impl, peer_endpoint.data(), p.p, is_continuation);
diff --git a/boost/asio/detail/winrt_ssocket_service_base.hpp b/boost/asio/detail/winrt_ssocket_service_base.hpp
index dcb5aa1c40..cb7b6c07f7 100644
--- a/boost/asio/detail/winrt_ssocket_service_base.hpp
+++ b/boost/asio/detail/winrt_ssocket_service_base.hpp
@@ -2,7 +2,7 @@
// detail/winrt_ssocket_service_base.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -21,7 +21,7 @@
#include <boost/asio/buffer.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
#include <boost/asio/socket_base.hpp>
#include <boost/asio/detail/buffer_sequence_adapter.hpp>
#include <boost/asio/detail/memory.hpp>
@@ -30,6 +30,12 @@
#include <boost/asio/detail/winrt_socket_recv_op.hpp>
#include <boost/asio/detail/winrt_socket_send_op.hpp>
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
+
#include <boost/asio/detail/push_options.hpp>
namespace boost {
@@ -62,8 +68,7 @@ public:
};
// Constructor.
- BOOST_ASIO_DECL winrt_ssocket_service_base(
- boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL winrt_ssocket_service_base(execution_context& context);
// Destroy all user-defined handler objects owned by the service.
BOOST_ASIO_DECL void base_shutdown();
@@ -193,21 +198,21 @@ public:
// Start an asynchronous send. The data being sent must be valid for the
// lifetime of the asynchronous operation.
- template <typename ConstBufferSequence, typename Handler>
+ template <typename ConstBufferSequence, typename Handler, typename IoExecutor>
void async_send(base_implementation_type& impl,
- const ConstBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const ConstBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef winrt_socket_send_op<ConstBufferSequence, Handler> op;
+ typedef winrt_socket_send_op<ConstBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "socket", &impl, 0, "async_send"));
start_send_op(impl,
@@ -218,13 +223,13 @@ public:
}
// Start an asynchronous wait until data can be sent without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_send(base_implementation_type&, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.get_io_context().post(
+ boost::asio::post(io_ex,
detail::bind_handler(handler, ec, bytes_transferred));
}
@@ -249,21 +254,22 @@ public:
// Start an asynchronous receive. The buffer for the data being received
// must be valid for the lifetime of the asynchronous operation.
- template <typename MutableBufferSequence, typename Handler>
+ template <typename MutableBufferSequence,
+ typename Handler, typename IoExecutor>
void async_receive(base_implementation_type& impl,
- const MutableBufferSequence& buffers,
- socket_base::message_flags flags, Handler& handler)
+ const MutableBufferSequence& buffers, socket_base::message_flags flags,
+ Handler& handler, const IoExecutor& io_ex)
{
bool is_continuation =
boost_asio_handler_cont_helpers::is_continuation(handler);
// Allocate and construct an operation to wrap the handler.
- typedef winrt_socket_recv_op<MutableBufferSequence, Handler> op;
+ typedef winrt_socket_recv_op<MutableBufferSequence, Handler, IoExecutor> op;
typename op::ptr p = { boost::asio::detail::addressof(handler),
op::ptr::allocate(handler), 0 };
- p.p = new (p.v) op(buffers, handler);
+ p.p = new (p.v) op(buffers, handler, io_ex);
- BOOST_ASIO_HANDLER_CREATION((io_context_.context(),
+ BOOST_ASIO_HANDLER_CREATION((scheduler_.context(),
*p.p, "socket", &impl, 0, "async_receive"));
start_receive_op(impl,
@@ -274,13 +280,13 @@ public:
}
// Wait until data can be received without blocking.
- template <typename Handler>
+ template <typename Handler, typename IoExecutor>
void async_receive(base_implementation_type&, const null_buffers&,
- socket_base::message_flags, Handler& handler)
+ socket_base::message_flags, Handler& handler, const IoExecutor& io_ex)
{
boost::system::error_code ec = boost::asio::error::operation_not_supported;
const std::size_t bytes_transferred = 0;
- io_context_.get_io_context().post(
+ boost::asio::post(io_ex,
detail::bind_handler(handler, ec, bytes_transferred));
}
@@ -333,8 +339,13 @@ protected:
winrt_async_op<Windows::Storage::Streams::IBuffer^>* op,
bool is_continuation);
- // The io_context implementation used for delivering completions.
- io_context_impl& io_context_;
+ // The scheduler implementation used for delivering completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
// The manager that keeps track of outstanding operations.
winrt_async_manager& async_manager_;
diff --git a/boost/asio/detail/winrt_timer_scheduler.hpp b/boost/asio/detail/winrt_timer_scheduler.hpp
index 8f61ad843e..d48ed2cb6a 100644
--- a/boost/asio/detail/winrt_timer_scheduler.hpp
+++ b/boost/asio/detail/winrt_timer_scheduler.hpp
@@ -2,7 +2,7 @@
// detail/winrt_timer_scheduler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -28,7 +28,13 @@
#include <boost/asio/detail/timer_queue_base.hpp>
#include <boost/asio/detail/timer_queue_set.hpp>
#include <boost/asio/detail/wait_op.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
#if defined(BOOST_ASIO_HAS_IOCP)
# include <boost/asio/detail/thread.hpp>
@@ -41,11 +47,11 @@ namespace asio {
namespace detail {
class winrt_timer_scheduler
- : public boost::asio::detail::service_base<winrt_timer_scheduler>
+ : public execution_context_service_base<winrt_timer_scheduler>
{
public:
// Constructor.
- BOOST_ASIO_DECL winrt_timer_scheduler(boost::asio::io_context& io_context);
+ BOOST_ASIO_DECL winrt_timer_scheduler(execution_context& context);
// Destructor.
BOOST_ASIO_DECL ~winrt_timer_scheduler();
@@ -54,8 +60,7 @@ public:
BOOST_ASIO_DECL void shutdown();
// Recreate internal descriptors following a fork.
- BOOST_ASIO_DECL void notify_fork(
- boost::asio::io_context::fork_event fork_ev);
+ BOOST_ASIO_DECL void notify_fork(execution_context::fork_event fork_ev);
// Initialise the task. No effect as this class uses its own thread.
BOOST_ASIO_DECL void init_task();
@@ -101,8 +106,13 @@ private:
// Helper function to remove a timer queue.
BOOST_ASIO_DECL void do_remove_timer_queue(timer_queue_base& queue);
- // The io_context implementation used to post completions.
- io_context_impl& io_context_;
+ // The scheduler implementation used to post completions.
+#if defined(BOOST_ASIO_HAS_IOCP)
+ typedef class win_iocp_io_context scheduler_impl;
+#else
+ typedef class scheduler scheduler_impl;
+#endif
+ scheduler_impl& scheduler_;
// Mutex used to protect internal variables.
boost::asio::detail::mutex mutex_;
diff --git a/boost/asio/detail/winrt_utils.hpp b/boost/asio/detail/winrt_utils.hpp
index 765edeecb8..bc765aeb66 100644
--- a/boost/asio/detail/winrt_utils.hpp
+++ b/boost/asio/detail/winrt_utils.hpp
@@ -2,7 +2,7 @@
// detail/winrt_utils.hpp
// ~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/winsock_init.hpp b/boost/asio/detail/winsock_init.hpp
index abf59cd1bf..dfda010839 100644
--- a/boost/asio/detail/winsock_init.hpp
+++ b/boost/asio/detail/winsock_init.hpp
@@ -2,7 +2,7 @@
// detail/winsock_init.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
diff --git a/boost/asio/detail/work_dispatcher.hpp b/boost/asio/detail/work_dispatcher.hpp
index 3167f244fd..9a92c45e02 100644
--- a/boost/asio/detail/work_dispatcher.hpp
+++ b/boost/asio/detail/work_dispatcher.hpp
@@ -2,7 +2,7 @@
// detail/work_dispatcher.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)
@@ -30,9 +30,10 @@ template <typename Handler>
class work_dispatcher
{
public:
- work_dispatcher(Handler& handler)
+ template <typename CompletionHandler>
+ explicit work_dispatcher(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler)
: work_((get_associated_executor)(handler)),
- handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler))
+ handler_(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler))
{
}
diff --git a/boost/asio/detail/wrapped_handler.hpp b/boost/asio/detail/wrapped_handler.hpp
index 8e23d1db9e..8496168975 100644
--- a/boost/asio/detail/wrapped_handler.hpp
+++ b/boost/asio/detail/wrapped_handler.hpp
@@ -2,7 +2,7 @@
// detail/wrapped_handler.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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)