diff --git a/asio/include/asio/datagram_socket_service.hpp b/asio/include/asio/datagram_socket_service.hpp index d8f80884..91fbdc93 100644 --- a/asio/include/asio/datagram_socket_service.hpp +++ b/asio/include/asio/datagram_socket_service.hpp @@ -422,9 +422,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/deadline_timer_service.hpp b/asio/include/asio/deadline_timer_service.hpp index cbc06182..5ef64c8e 100644 --- a/asio/include/asio/deadline_timer_service.hpp +++ b/asio/include/asio/deadline_timer_service.hpp @@ -151,9 +151,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/detail/deadline_timer_service.hpp b/asio/include/asio/detail/deadline_timer_service.hpp index 2a203b4b..13af0ff6 100644 --- a/asio/include/asio/detail/deadline_timer_service.hpp +++ b/asio/include/asio/detail/deadline_timer_service.hpp @@ -75,7 +75,7 @@ public: } // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { } diff --git a/asio/include/asio/detail/dev_poll_reactor.hpp b/asio/include/asio/detail/dev_poll_reactor.hpp index 39404418..5889c507 100644 --- a/asio/include/asio/detail/dev_poll_reactor.hpp +++ b/asio/include/asio/detail/dev_poll_reactor.hpp @@ -59,10 +59,10 @@ public: ASIO_DECL ~dev_poll_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Recreate internal descriptors following a fork. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::execution_context::fork_event fork_ev); // Initialise the task. diff --git a/asio/include/asio/detail/epoll_reactor.hpp b/asio/include/asio/detail/epoll_reactor.hpp index 11a0a4ed..445990a1 100644 --- a/asio/include/asio/detail/epoll_reactor.hpp +++ b/asio/include/asio/detail/epoll_reactor.hpp @@ -78,10 +78,10 @@ public: ASIO_DECL ~epoll_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Recreate internal descriptors following a fork. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::execution_context::fork_event fork_ev); // Initialise the task. diff --git a/asio/include/asio/detail/impl/dev_poll_reactor.ipp b/asio/include/asio/detail/impl/dev_poll_reactor.ipp index a1148e3f..19fcc719 100644 --- a/asio/include/asio/detail/impl/dev_poll_reactor.ipp +++ b/asio/include/asio/detail/impl/dev_poll_reactor.ipp @@ -47,11 +47,11 @@ dev_poll_reactor::dev_poll_reactor(asio::execution_context& ctx) dev_poll_reactor::~dev_poll_reactor() { - shutdown_service(); + shutdown(); ::close(dev_poll_fd_); } -void dev_poll_reactor::shutdown_service() +void dev_poll_reactor::shutdown() { asio::detail::mutex::scoped_lock lock(mutex_); shutdown_ = true; @@ -67,7 +67,7 @@ void dev_poll_reactor::shutdown_service() scheduler_.abandon_operations(ops); } -void dev_poll_reactor::fork_service(asio::io_context::fork_event fork_ev) +void dev_poll_reactor::notify_fork(asio::io_context::fork_event fork_ev) { if (fork_ev == asio::execution_context::fork_child) { diff --git a/asio/include/asio/detail/impl/epoll_reactor.ipp b/asio/include/asio/detail/impl/epoll_reactor.ipp index d72737b6..143df362 100644 --- a/asio/include/asio/detail/impl/epoll_reactor.ipp +++ b/asio/include/asio/detail/impl/epoll_reactor.ipp @@ -67,7 +67,7 @@ epoll_reactor::~epoll_reactor() close(timer_fd_); } -void epoll_reactor::shutdown_service() +void epoll_reactor::shutdown() { mutex::scoped_lock lock(mutex_); shutdown_ = true; @@ -88,7 +88,7 @@ void epoll_reactor::shutdown_service() scheduler_.abandon_operations(ops); } -void epoll_reactor::fork_service( +void epoll_reactor::notify_fork( asio::execution_context::fork_event fork_ev) { if (fork_ev == asio::execution_context::fork_child) diff --git a/asio/include/asio/detail/impl/kqueue_reactor.ipp b/asio/include/asio/detail/impl/kqueue_reactor.ipp index b92096e4..c3accc62 100644 --- a/asio/include/asio/detail/impl/kqueue_reactor.ipp +++ b/asio/include/asio/detail/impl/kqueue_reactor.ipp @@ -63,7 +63,7 @@ kqueue_reactor::~kqueue_reactor() close(kqueue_fd_); } -void kqueue_reactor::shutdown_service() +void kqueue_reactor::shutdown() { mutex::scoped_lock lock(mutex_); shutdown_ = true; @@ -84,7 +84,7 @@ void kqueue_reactor::shutdown_service() scheduler_.abandon_operations(ops); } -void kqueue_reactor::fork_service( +void kqueue_reactor::notify_fork( asio::execution_context::fork_event fork_ev) { if (fork_ev == asio::execution_context::fork_child) diff --git a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp index 37ddaf21..849abe88 100644 --- a/asio/include/asio/detail/impl/reactive_descriptor_service.ipp +++ b/asio/include/asio/detail/impl/reactive_descriptor_service.ipp @@ -36,7 +36,7 @@ reactive_descriptor_service::reactive_descriptor_service( reactor_.init_task(); } -void reactive_descriptor_service::shutdown_service() +void reactive_descriptor_service::shutdown() { } diff --git a/asio/include/asio/detail/impl/reactive_serial_port_service.ipp b/asio/include/asio/detail/impl/reactive_serial_port_service.ipp index 49a94a4e..d16c7cdd 100644 --- a/asio/include/asio/detail/impl/reactive_serial_port_service.ipp +++ b/asio/include/asio/detail/impl/reactive_serial_port_service.ipp @@ -35,9 +35,9 @@ reactive_serial_port_service::reactive_serial_port_service( { } -void reactive_serial_port_service::shutdown_service() +void reactive_serial_port_service::shutdown() { - descriptor_service_.shutdown_service(); + descriptor_service_.shutdown(); } asio::error_code reactive_serial_port_service::open( diff --git a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp index 76d6da2d..25920936 100644 --- a/asio/include/asio/detail/impl/reactive_socket_service_base.ipp +++ b/asio/include/asio/detail/impl/reactive_socket_service_base.ipp @@ -35,7 +35,7 @@ reactive_socket_service_base::reactive_socket_service_base( reactor_.init_task(); } -void reactive_socket_service_base::shutdown_service() +void reactive_socket_service_base::shutdown() { } diff --git a/asio/include/asio/detail/impl/resolver_service_base.ipp b/asio/include/asio/detail/impl/resolver_service_base.ipp index 0f14374f..9b225b7b 100644 --- a/asio/include/asio/detail/impl/resolver_service_base.ipp +++ b/asio/include/asio/detail/impl/resolver_service_base.ipp @@ -46,10 +46,10 @@ resolver_service_base::resolver_service_base( resolver_service_base::~resolver_service_base() { - shutdown_service(); + shutdown(); } -void resolver_service_base::shutdown_service() +void resolver_service_base::shutdown() { work_.reset(); if (work_io_context_.get()) @@ -64,7 +64,7 @@ void resolver_service_base::shutdown_service() } } -void resolver_service_base::fork_service( +void resolver_service_base::notify_fork( asio::io_context::fork_event fork_ev) { if (work_thread_.get()) diff --git a/asio/include/asio/detail/impl/scheduler.ipp b/asio/include/asio/detail/impl/scheduler.ipp index 66c9009a..6bc9cf0f 100644 --- a/asio/include/asio/detail/impl/scheduler.ipp +++ b/asio/include/asio/detail/impl/scheduler.ipp @@ -97,7 +97,7 @@ scheduler::scheduler( ASIO_HANDLER_TRACKING_INIT; } -void scheduler::shutdown_service() +void scheduler::shutdown() { mutex::scoped_lock lock(mutex_); shutdown_ = true; diff --git a/asio/include/asio/detail/impl/select_reactor.ipp b/asio/include/asio/detail/impl/select_reactor.ipp index cb0eef3c..a3d28763 100644 --- a/asio/include/asio/detail/impl/select_reactor.ipp +++ b/asio/include/asio/detail/impl/select_reactor.ipp @@ -71,10 +71,10 @@ select_reactor::select_reactor(asio::execution_context& ctx) select_reactor::~select_reactor() { - shutdown_service(); + shutdown(); } -void select_reactor::shutdown_service() +void select_reactor::shutdown() { asio::detail::mutex::scoped_lock lock(mutex_); shutdown_ = true; @@ -103,7 +103,7 @@ void select_reactor::shutdown_service() scheduler_.abandon_operations(ops); } -void select_reactor::fork_service( +void select_reactor::notify_fork( asio::execution_context::fork_event fork_ev) { if (fork_ev == asio::execution_context::fork_child) diff --git a/asio/include/asio/detail/impl/service_registry.ipp b/asio/include/asio/detail/impl/service_registry.ipp index a54e96d0..39dad4d4 100644 --- a/asio/include/asio/detail/impl/service_registry.ipp +++ b/asio/include/asio/detail/impl/service_registry.ipp @@ -40,7 +40,7 @@ void service_registry::shutdown_services() execution_context::service* service = first_service_; while (service) { - service->shutdown_service(); + service->shutdown(); service = service->next_; } } @@ -78,10 +78,10 @@ void service_registry::notify_fork(execution_context::fork_event fork_ev) std::size_t num_services = services.size(); if (fork_ev == execution_context::fork_prepare) for (std::size_t i = 0; i < num_services; ++i) - services[i]->fork_service(fork_ev); + services[i]->notify_fork(fork_ev); else for (std::size_t i = num_services; i > 0; --i) - services[i - 1]->fork_service(fork_ev); + services[i - 1]->notify_fork(fork_ev); } void service_registry::init_key(execution_context::service::key& key, diff --git a/asio/include/asio/detail/impl/signal_set_service.ipp b/asio/include/asio/detail/impl/signal_set_service.ipp index 252caf29..f26fbe03 100644 --- a/asio/include/asio/detail/impl/signal_set_service.ipp +++ b/asio/include/asio/detail/impl/signal_set_service.ipp @@ -150,7 +150,7 @@ signal_set_service::~signal_set_service() remove_service(this); } -void signal_set_service::shutdown_service() +void signal_set_service::shutdown() { remove_service(this); @@ -169,7 +169,7 @@ void signal_set_service::shutdown_service() io_context_.abandon_operations(ops); } -void signal_set_service::fork_service( +void signal_set_service::notify_fork( asio::io_context::fork_event fork_ev) { #if !defined(ASIO_WINDOWS) \ diff --git a/asio/include/asio/detail/impl/strand_executor_service.ipp b/asio/include/asio/detail/impl/strand_executor_service.ipp index 2e62a79f..fc2602b4 100644 --- a/asio/include/asio/detail/impl/strand_executor_service.ipp +++ b/asio/include/asio/detail/impl/strand_executor_service.ipp @@ -31,7 +31,7 @@ strand_executor_service::strand_executor_service(execution_context& ctx) { } -void strand_executor_service::shutdown_service() +void strand_executor_service::shutdown() { op_queue ops; diff --git a/asio/include/asio/detail/impl/strand_service.ipp b/asio/include/asio/detail/impl/strand_service.ipp index c7539b57..6a5690b8 100644 --- a/asio/include/asio/detail/impl/strand_service.ipp +++ b/asio/include/asio/detail/impl/strand_service.ipp @@ -49,7 +49,7 @@ strand_service::strand_service(asio::io_context& io_context) { } -void strand_service::shutdown_service() +void strand_service::shutdown() { op_queue ops; diff --git a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp index 27d757fa..1ede41d3 100644 --- a/asio/include/asio/detail/impl/win_iocp_handle_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_handle_service.ipp @@ -73,7 +73,7 @@ win_iocp_handle_service::win_iocp_handle_service( { } -void win_iocp_handle_service::shutdown_service() +void win_iocp_handle_service::shutdown() { // Close all implementations, causing all operations to complete. asio::detail::mutex::scoped_lock lock(mutex_); diff --git a/asio/include/asio/detail/impl/win_iocp_io_context.ipp b/asio/include/asio/detail/impl/win_iocp_io_context.ipp index 6d4ef2fa..bf5a20f5 100644 --- a/asio/include/asio/detail/impl/win_iocp_io_context.ipp +++ b/asio/include/asio/detail/impl/win_iocp_io_context.ipp @@ -86,7 +86,7 @@ win_iocp_io_context::win_iocp_io_context( } } -void win_iocp_io_context::shutdown_service() +void win_iocp_io_context::shutdown() { ::InterlockedExchange(&shutdown_, 1); diff --git a/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp b/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp index 03129f48..26a8e29e 100644 --- a/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/asio/include/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -34,7 +34,7 @@ win_iocp_serial_port_service::win_iocp_serial_port_service( { } -void win_iocp_serial_port_service::shutdown_service() +void win_iocp_serial_port_service::shutdown() { } diff --git a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp index 00b554b1..bae97025 100644 --- a/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/asio/include/asio/detail/impl/win_iocp_socket_service_base.ipp @@ -37,7 +37,7 @@ win_iocp_socket_service_base::win_iocp_socket_service_base( { } -void win_iocp_socket_service_base::shutdown_service() +void win_iocp_socket_service_base::shutdown() { // Close all implementations, causing all operations to complete. asio::detail::mutex::scoped_lock lock(mutex_); diff --git a/asio/include/asio/detail/impl/win_object_handle_service.ipp b/asio/include/asio/detail/impl/win_object_handle_service.ipp index 0caaad42..2e714b43 100644 --- a/asio/include/asio/detail/impl/win_object_handle_service.ipp +++ b/asio/include/asio/detail/impl/win_object_handle_service.ipp @@ -36,7 +36,7 @@ win_object_handle_service::win_object_handle_service( { } -void win_object_handle_service::shutdown_service() +void win_object_handle_service::shutdown() { mutex::scoped_lock lock(mutex_); diff --git a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp index c6cedea2..4d75aaaa 100644 --- a/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp +++ b/asio/include/asio/detail/impl/winrt_ssocket_service_base.ipp @@ -38,7 +38,7 @@ winrt_ssocket_service_base::winrt_ssocket_service_base( { } -void winrt_ssocket_service_base::shutdown_service() +void winrt_ssocket_service_base::shutdown() { // Close all implementations, causing all operations to complete. asio::detail::mutex::scoped_lock lock(mutex_); diff --git a/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp b/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp index 97eaa7d9..7c11dbbe 100644 --- a/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp +++ b/asio/include/asio/detail/impl/winrt_timer_scheduler.ipp @@ -44,10 +44,10 @@ winrt_timer_scheduler::winrt_timer_scheduler( winrt_timer_scheduler::~winrt_timer_scheduler() { - shutdown_service(); + shutdown(); } -void winrt_timer_scheduler::shutdown_service() +void winrt_timer_scheduler::shutdown() { asio::detail::mutex::scoped_lock lock(mutex_); shutdown_ = true; @@ -67,7 +67,7 @@ void winrt_timer_scheduler::shutdown_service() io_context_.abandon_operations(ops); } -void winrt_timer_scheduler::fork_service(asio::io_context::fork_event) +void winrt_timer_scheduler::notify_fork(asio::io_context::fork_event) { } diff --git a/asio/include/asio/detail/kqueue_reactor.hpp b/asio/include/asio/detail/kqueue_reactor.hpp index 80bdce1a..8eed6770 100644 --- a/asio/include/asio/detail/kqueue_reactor.hpp +++ b/asio/include/asio/detail/kqueue_reactor.hpp @@ -82,10 +82,10 @@ public: ASIO_DECL ~kqueue_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Recreate internal descriptors following a fork. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::execution_context::fork_event fork_ev); // Initialise the task. diff --git a/asio/include/asio/detail/null_reactor.hpp b/asio/include/asio/detail/null_reactor.hpp index 8d2cc843..a303a0e0 100644 --- a/asio/include/asio/detail/null_reactor.hpp +++ b/asio/include/asio/detail/null_reactor.hpp @@ -43,7 +43,7 @@ public: } // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { } diff --git a/asio/include/asio/detail/null_socket_service.hpp b/asio/include/asio/detail/null_socket_service.hpp index 706f0a3d..0a5d9451 100644 --- a/asio/include/asio/detail/null_socket_service.hpp +++ b/asio/include/asio/detail/null_socket_service.hpp @@ -55,7 +55,7 @@ public: } // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { } diff --git a/asio/include/asio/detail/reactive_descriptor_service.hpp b/asio/include/asio/detail/reactive_descriptor_service.hpp index 671a1b53..5f37e163 100644 --- a/asio/include/asio/detail/reactive_descriptor_service.hpp +++ b/asio/include/asio/detail/reactive_descriptor_service.hpp @@ -78,7 +78,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new descriptor implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/reactive_serial_port_service.hpp b/asio/include/asio/detail/reactive_serial_port_service.hpp index 01a58323..e30a1fc8 100644 --- a/asio/include/asio/detail/reactive_serial_port_service.hpp +++ b/asio/include/asio/detail/reactive_serial_port_service.hpp @@ -47,7 +47,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new serial port implementation. void construct(implementation_type& impl) diff --git a/asio/include/asio/detail/reactive_socket_service_base.hpp b/asio/include/asio/detail/reactive_socket_service_base.hpp index 04d95a28..a938d9d3 100644 --- a/asio/include/asio/detail/reactive_socket_service_base.hpp +++ b/asio/include/asio/detail/reactive_socket_service_base.hpp @@ -66,7 +66,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new socket implementation. ASIO_DECL void construct(base_implementation_type& impl); diff --git a/asio/include/asio/detail/resolver_service_base.hpp b/asio/include/asio/detail/resolver_service_base.hpp index 80ae121c..fcd9bd19 100644 --- a/asio/include/asio/detail/resolver_service_base.hpp +++ b/asio/include/asio/detail/resolver_service_base.hpp @@ -45,10 +45,10 @@ public: ASIO_DECL ~resolver_service_base(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Perform any fork-related housekeeping. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::io_context::fork_event fork_ev); // Construct a new resolver implementation. diff --git a/asio/include/asio/detail/scheduler.hpp b/asio/include/asio/detail/scheduler.hpp index fa804948..6bdcfbb4 100644 --- a/asio/include/asio/detail/scheduler.hpp +++ b/asio/include/asio/detail/scheduler.hpp @@ -47,7 +47,7 @@ public: std::size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Initialise the task, if required. ASIO_DECL void init_task(); @@ -113,8 +113,8 @@ public: // operation for immediate invocation. ASIO_DECL void do_dispatch(operation* op); - // Process unfinished operations as part of a shutdown_service operation. - // Assumes that work_started() was previously called for the operations. + // Process unfinished operations as part of a shutdownoperation. Assumes that + // work_started() was previously called for the operations. ASIO_DECL void abandon_operations(op_queue& ops); private: diff --git a/asio/include/asio/detail/select_reactor.hpp b/asio/include/asio/detail/select_reactor.hpp index 3021775d..a514d383 100644 --- a/asio/include/asio/detail/select_reactor.hpp +++ b/asio/include/asio/detail/select_reactor.hpp @@ -70,10 +70,10 @@ public: ASIO_DECL ~select_reactor(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Recreate internal descriptors following a fork. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::execution_context::fork_event fork_ev); // Initialise the task, but only if the reactor is not in its own thread. diff --git a/asio/include/asio/detail/signal_set_service.hpp b/asio/include/asio/detail/signal_set_service.hpp index d25d474b..6e498bb7 100644 --- a/asio/include/asio/detail/signal_set_service.hpp +++ b/asio/include/asio/detail/signal_set_service.hpp @@ -114,10 +114,10 @@ public: ASIO_DECL ~signal_set_service(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Perform fork-related housekeeping. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::io_context::fork_event fork_ev); // Construct a new signal_set implementation. diff --git a/asio/include/asio/detail/strand_executor_service.hpp b/asio/include/asio/detail/strand_executor_service.hpp index d149e4f4..869ce972 100644 --- a/asio/include/asio/detail/strand_executor_service.hpp +++ b/asio/include/asio/detail/strand_executor_service.hpp @@ -76,7 +76,7 @@ public: ASIO_DECL explicit strand_executor_service(execution_context& context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Create a new strand_executor implementation. ASIO_DECL implementation_type create_implementation(); diff --git a/asio/include/asio/detail/strand_service.hpp b/asio/include/asio/detail/strand_service.hpp index 84ec68a5..cb8104ff 100644 --- a/asio/include/asio/detail/strand_service.hpp +++ b/asio/include/asio/detail/strand_service.hpp @@ -78,7 +78,7 @@ public: ASIO_DECL explicit strand_service(asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new strand implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/win_iocp_handle_service.hpp b/asio/include/asio/detail/win_iocp_handle_service.hpp index 4b8257c5..02f84c2f 100644 --- a/asio/include/asio/detail/win_iocp_handle_service.hpp +++ b/asio/include/asio/detail/win_iocp_handle_service.hpp @@ -77,7 +77,7 @@ public: ASIO_DECL win_iocp_handle_service(asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new handle implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/win_iocp_io_context.hpp b/asio/include/asio/detail/win_iocp_io_context.hpp index 6f151cbd..ffb8c3b5 100644 --- a/asio/include/asio/detail/win_iocp_io_context.hpp +++ b/asio/include/asio/detail/win_iocp_io_context.hpp @@ -51,7 +51,7 @@ public: size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Initialise the task. Nothing to do here. void init_task() @@ -148,8 +148,8 @@ public: post_immediate_completion(op, false); } - // Process unfinished operations as part of a shutdown_service operation. - // Assumes that work_started() was previously called for the operations. + // Process unfinished operations as part of a shutdown operation. Assumes + // that work_started() was previously called for the operations. ASIO_DECL void abandon_operations(op_queue& ops); // Called after starting an overlapped I/O operation that did not complete diff --git a/asio/include/asio/detail/win_iocp_serial_port_service.hpp b/asio/include/asio/detail/win_iocp_serial_port_service.hpp index b3969adf..3fa2da5b 100644 --- a/asio/include/asio/detail/win_iocp_serial_port_service.hpp +++ b/asio/include/asio/detail/win_iocp_serial_port_service.hpp @@ -45,7 +45,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new serial port implementation. void construct(implementation_type& impl) diff --git a/asio/include/asio/detail/win_iocp_socket_service_base.hpp b/asio/include/asio/detail/win_iocp_socket_service_base.hpp index 471f097a..a98e8ded 100644 --- a/asio/include/asio/detail/win_iocp_socket_service_base.hpp +++ b/asio/include/asio/detail/win_iocp_socket_service_base.hpp @@ -89,7 +89,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new socket implementation. ASIO_DECL void construct(base_implementation_type& impl); diff --git a/asio/include/asio/detail/win_object_handle_service.hpp b/asio/include/asio/detail/win_object_handle_service.hpp index 4236d9c8..4ee0963b 100644 --- a/asio/include/asio/detail/win_object_handle_service.hpp +++ b/asio/include/asio/detail/win_object_handle_service.hpp @@ -82,7 +82,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new handle implementation. ASIO_DECL void construct(implementation_type& impl); diff --git a/asio/include/asio/detail/winrt_async_manager.hpp b/asio/include/asio/detail/winrt_async_manager.hpp index 89bd27b4..63e51f4d 100644 --- a/asio/include/asio/detail/winrt_async_manager.hpp +++ b/asio/include/asio/detail/winrt_async_manager.hpp @@ -48,7 +48,7 @@ public: } // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { if (--outstanding_ops_ > 0) { diff --git a/asio/include/asio/detail/winrt_resolver_service.hpp b/asio/include/asio/detail/winrt_resolver_service.hpp index 9649e579..de7b8e3f 100644 --- a/asio/include/asio/detail/winrt_resolver_service.hpp +++ b/asio/include/asio/detail/winrt_resolver_service.hpp @@ -64,12 +64,12 @@ public: } // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { } // Perform any fork-related housekeeping. - void fork_service(asio::io_context::fork_event) + void notify_fork(asio::io_context::fork_event) { } diff --git a/asio/include/asio/detail/winrt_ssocket_service_base.hpp b/asio/include/asio/detail/winrt_ssocket_service_base.hpp index bb901dfc..658494ec 100644 --- a/asio/include/asio/detail/winrt_ssocket_service_base.hpp +++ b/asio/include/asio/detail/winrt_ssocket_service_base.hpp @@ -65,7 +65,7 @@ public: asio::io_context& io_context); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Construct a new socket implementation. ASIO_DECL void construct(base_implementation_type&); diff --git a/asio/include/asio/detail/winrt_timer_scheduler.hpp b/asio/include/asio/detail/winrt_timer_scheduler.hpp index f439e1a2..51699147 100644 --- a/asio/include/asio/detail/winrt_timer_scheduler.hpp +++ b/asio/include/asio/detail/winrt_timer_scheduler.hpp @@ -50,10 +50,10 @@ public: ASIO_DECL ~winrt_timer_scheduler(); // Destroy all user-defined handler objects owned by the service. - ASIO_DECL void shutdown_service(); + ASIO_DECL void shutdown(); // Recreate internal descriptors following a fork. - ASIO_DECL void fork_service( + ASIO_DECL void notify_fork( asio::io_context::fork_event fork_ev); // Initialise the task. No effect as this class uses its own thread. diff --git a/asio/include/asio/execution_context.hpp b/asio/include/asio/execution_context.hpp index 5d428392..2a6edb7a 100644 --- a/asio/include/asio/execution_context.hpp +++ b/asio/include/asio/execution_context.hpp @@ -83,8 +83,8 @@ namespace detail { class service_registry; } * type. * * On destruction, a class that is derived from execution_context must perform - * execution_context::shutdown_context() followed by - * execution_context::destroy_context(). + * execution_context::shutdown() followed by + * execution_context::destroy(). * * This destruction sequence permits programs to simplify their resource * management by using @c shared_ptr<>. Where an object's lifetime is tied to @@ -98,9 +98,9 @@ namespace detail { class service_registry; } * * @li To shut down the whole program, the io_context function stop() is called * to terminate any run() calls as soon as possible. The io_context destructor - * calls @c shutdown_context() and @c destroy_context() to destroy all pending - * handlers, causing all @c shared_ptr references to all connection objects to - * be destroyed. + * calls @c shutdown() and @c destroy() to destroy all pending handlers, + * causing all @c shared_ptr references to all connection objects to be + * destroyed. */ class execution_context : private noncopyable @@ -122,9 +122,9 @@ protected: * * @li For each service object @c svc in the execution_context set, in * reverse order of the beginning of service object lifetime, performs @c - * svc->shutdown_service(). + * svc->shutdown(). */ - ASIO_DECL void shutdown_context(); + ASIO_DECL void shutdown(); /// Destroys all services in the context. /** @@ -134,7 +134,7 @@ protected: * reverse order * of the beginning of service object lifetime, performs * delete static_cast(svc). */ - ASIO_DECL void destroy_context(); + ASIO_DECL void destroy(); public: /// Fork-related event notifications. @@ -185,7 +185,7 @@ public: * } @endcode * * @note For each service object @c svc in the execution_context set, - * performs svc->fork_service();. When processing the fork_prepare + * performs svc->notify_fork();. When processing the fork_prepare * event, services are visited in reverse order of the beginning of service * object lifetime. Otherwise, services are visited in order of the beginning * of service object lifetime. @@ -330,7 +330,7 @@ protected: private: /// Destroy all user-defined handler objects owned by the service. - virtual void shutdown_service() = 0; + virtual void shutdown() = 0; /// Handle notification of a fork-related event to perform any necessary /// housekeeping. @@ -338,7 +338,7 @@ private: * This function is not a pure virtual so that services only have to * implement it if necessary. The default implementation does nothing. */ - ASIO_DECL virtual void fork_service( + ASIO_DECL virtual void notify_fork( execution_context::fork_event event); friend class asio::detail::service_registry; diff --git a/asio/include/asio/impl/execution_context.ipp b/asio/include/asio/impl/execution_context.ipp index 5019b232..38e40e3c 100644 --- a/asio/include/asio/impl/execution_context.ipp +++ b/asio/include/asio/impl/execution_context.ipp @@ -30,17 +30,17 @@ execution_context::execution_context() execution_context::~execution_context() { - shutdown_context(); - destroy_context(); + shutdown(); + destroy(); delete service_registry_; } -void execution_context::shutdown_context() +void execution_context::shutdown() { service_registry_->shutdown_services(); } -void execution_context::destroy_context() +void execution_context::destroy() { service_registry_->destroy_services(); } @@ -61,7 +61,7 @@ execution_context::service::~service() { } -void execution_context::service::fork_service(execution_context::fork_event) +void execution_context::service::notify_fork(execution_context::fork_event) { } diff --git a/asio/include/asio/impl/io_context.ipp b/asio/include/asio/impl/io_context.ipp index b35a8481..2cce94bc 100644 --- a/asio/include/asio/impl/io_context.ipp +++ b/asio/include/asio/impl/io_context.ipp @@ -130,6 +130,34 @@ io_context::service::~service() { } +void io_context::service::shutdown() +{ +#if !defined(ASIO_NO_DEPRECATED) + shutdown_service(); +#endif // !defined(ASIO_NO_DEPRECATED) +} + +#if !defined(ASIO_NO_DEPRECATED) +void io_context::service::shutdown_service() +{ +} +#endif // !defined(ASIO_NO_DEPRECATED) + +void io_context::service::notify_fork(io_context::fork_event ev) +{ +#if !defined(ASIO_NO_DEPRECATED) + fork_service(ev); +#else // !defined(ASIO_NO_DEPRECATED) + (void)ev; +#endif // !defined(ASIO_NO_DEPRECATED) +} + +#if !defined(ASIO_NO_DEPRECATED) +void io_context::service::fork_service(io_context::fork_event) +{ +} +#endif // !defined(ASIO_NO_DEPRECATED) + } // namespace asio #include "asio/detail/pop_options.hpp" diff --git a/asio/include/asio/io_context.hpp b/asio/include/asio/io_context.hpp index 8e672c76..2f92a6dc 100644 --- a/asio/include/asio/io_context.hpp +++ b/asio/include/asio/io_context.hpp @@ -179,7 +179,7 @@ public: * * @li For each service object @c svc in the io_context set, in reverse order * of the beginning of service object lifetime, performs - * @c svc->shutdown_service(). + * @c svc->shutdown(). * * @li Uninvoked handler objects that were scheduled for deferred invocation * on the io_context, or any associated strand, are destroyed. @@ -684,6 +684,36 @@ public: asio::io_context& get_io_service(); #endif // !defined(ASIO_NO_DEPRECATED) +private: + /// Destroy all user-defined handler objects owned by the service. + ASIO_DECL virtual void shutdown(); + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use shutdown().) Destroy all user-defined handler objects + /// owned by the service. + ASIO_DECL virtual void shutdown_service(); +#endif // !defined(ASIO_NO_DEPRECATED) + + /// Handle notification of a fork-related event to perform any necessary + /// housekeeping. + /** + * This function is not a pure virtual so that services only have to + * implement it if necessary. The default implementation does nothing. + */ + ASIO_DECL virtual void notify_fork( + execution_context::fork_event event); + +#if !defined(ASIO_NO_DEPRECATED) + /// (Deprecated: Use notify_fork().) Handle notification of a fork-related + /// event to perform any necessary housekeeping. + /** + * This function is not a pure virtual so that services only have to + * implement it if necessary. The default implementation does nothing. + */ + ASIO_DECL virtual void fork_service( + execution_context::fork_event event); +#endif // !defined(ASIO_NO_DEPRECATED) + protected: /// Constructor. /** diff --git a/asio/include/asio/ip/resolver_service.hpp b/asio/include/asio/ip/resolver_service.hpp index 01959580..c3108513 100644 --- a/asio/include/asio/ip/resolver_service.hpp +++ b/asio/include/asio/ip/resolver_service.hpp @@ -155,15 +155,15 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // Perform any fork-related housekeeping. - void fork_service(asio::io_context::fork_event event) + void notify_fork(asio::io_context::fork_event event) { - service_impl_.fork_service(event); + service_impl_.notify_fork(event); } // The platform-specific implementation. diff --git a/asio/include/asio/posix/stream_descriptor_service.hpp b/asio/include/asio/posix/stream_descriptor_service.hpp index 0c524951..63d01b5b 100644 --- a/asio/include/asio/posix/stream_descriptor_service.hpp +++ b/asio/include/asio/posix/stream_descriptor_service.hpp @@ -248,9 +248,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/raw_socket_service.hpp b/asio/include/asio/raw_socket_service.hpp index f0da7c52..d095e840 100644 --- a/asio/include/asio/raw_socket_service.hpp +++ b/asio/include/asio/raw_socket_service.hpp @@ -422,9 +422,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/seq_packet_socket_service.hpp b/asio/include/asio/seq_packet_socket_service.hpp index 17cd1400..7b9ff4f5 100644 --- a/asio/include/asio/seq_packet_socket_service.hpp +++ b/asio/include/asio/seq_packet_socket_service.hpp @@ -372,9 +372,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/serial_port_service.hpp b/asio/include/asio/serial_port_service.hpp index 907dee98..7fca7b25 100644 --- a/asio/include/asio/serial_port_service.hpp +++ b/asio/include/asio/serial_port_service.hpp @@ -219,9 +219,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/signal_set_service.hpp b/asio/include/asio/signal_set_service.hpp index 4ba418a2..a4e4b279 100644 --- a/asio/include/asio/signal_set_service.hpp +++ b/asio/include/asio/signal_set_service.hpp @@ -111,15 +111,15 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // Perform any fork-related housekeeping. - void fork_service(asio::io_context::fork_event event) + void notify_fork(asio::io_context::fork_event event) { - service_impl_.fork_service(event); + service_impl_.notify_fork(event); } // The platform-specific implementation. diff --git a/asio/include/asio/socket_acceptor_service.hpp b/asio/include/asio/socket_acceptor_service.hpp index f2b60040..157177da 100644 --- a/asio/include/asio/socket_acceptor_service.hpp +++ b/asio/include/asio/socket_acceptor_service.hpp @@ -326,9 +326,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/stream_socket_service.hpp b/asio/include/asio/stream_socket_service.hpp index 517bc1f5..6cee6ca5 100644 --- a/asio/include/asio/stream_socket_service.hpp +++ b/asio/include/asio/stream_socket_service.hpp @@ -368,9 +368,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/waitable_timer_service.hpp b/asio/include/asio/waitable_timer_service.hpp index ac34aa52..30115942 100644 --- a/asio/include/asio/waitable_timer_service.hpp +++ b/asio/include/asio/waitable_timer_service.hpp @@ -189,9 +189,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/windows/object_handle_service.hpp b/asio/include/asio/windows/object_handle_service.hpp index 2bd27938..86c9a4f0 100644 --- a/asio/include/asio/windows/object_handle_service.hpp +++ b/asio/include/asio/windows/object_handle_service.hpp @@ -156,9 +156,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/windows/random_access_handle_service.hpp b/asio/include/asio/windows/random_access_handle_service.hpp index c2976ab1..2dbab74e 100644 --- a/asio/include/asio/windows/random_access_handle_service.hpp +++ b/asio/include/asio/windows/random_access_handle_service.hpp @@ -185,9 +185,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/include/asio/windows/stream_handle_service.hpp b/asio/include/asio/windows/stream_handle_service.hpp index b4980772..af95ba03 100644 --- a/asio/include/asio/windows/stream_handle_service.hpp +++ b/asio/include/asio/windows/stream_handle_service.hpp @@ -183,9 +183,9 @@ public: private: // Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { - service_impl_.shutdown_service(); + service_impl_.shutdown(); } // The platform-specific implementation. diff --git a/asio/src/examples/cpp03/services/stream_socket_service.hpp b/asio/src/examples/cpp03/services/stream_socket_service.hpp index 0e904beb..d4d0c22b 100644 --- a/asio/src/examples/cpp03/services/stream_socket_service.hpp +++ b/asio/src/examples/cpp03/services/stream_socket_service.hpp @@ -52,7 +52,7 @@ public: } /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() + void shutdown() { } diff --git a/asio/src/examples/cpp11/executors/pipeline.cpp b/asio/src/examples/cpp11/executors/pipeline.cpp index 4bfa169c..4159333d 100644 --- a/asio/src/examples/cpp11/executors/pipeline.cpp +++ b/asio/src/examples/cpp11/executors/pipeline.cpp @@ -43,7 +43,7 @@ private: } private: - virtual void shutdown_service() + virtual void shutdown() { for (auto& t : threads_) t.join(); diff --git a/asio/src/examples/cpp14/executors/pipeline.cpp b/asio/src/examples/cpp14/executors/pipeline.cpp index 484b959b..77a5c0a2 100644 --- a/asio/src/examples/cpp14/executors/pipeline.cpp +++ b/asio/src/examples/cpp14/executors/pipeline.cpp @@ -38,7 +38,7 @@ private: } private: - virtual void shutdown_service() + virtual void shutdown() { for (auto& t : threads_) t.join();