Rename execution_context members to shutdown and destroy.
The execution_context member functions shutdown_context and destroy_context have been renamed to shutdown and destroy, respectively. Similarly, execution_context::service::shutdown_service has been renamed to shutdown.
This commit is contained in:
parent
d3bbf3756d
commit
f1ebd9522f
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -75,7 +75,7 @@ public:
|
||||
}
|
||||
|
||||
// Destroy all user-defined handler objects owned by the service.
|
||||
void shutdown_service()
|
||||
void shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -36,7 +36,7 @@ reactive_descriptor_service::reactive_descriptor_service(
|
||||
reactor_.init_task();
|
||||
}
|
||||
|
||||
void reactive_descriptor_service::shutdown_service()
|
||||
void reactive_descriptor_service::shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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())
|
||||
|
@ -97,7 +97,7 @@ scheduler::scheduler(
|
||||
ASIO_HANDLER_TRACKING_INIT;
|
||||
}
|
||||
|
||||
void scheduler::shutdown_service()
|
||||
void scheduler::shutdown()
|
||||
{
|
||||
mutex::scoped_lock lock(mutex_);
|
||||
shutdown_ = true;
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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) \
|
||||
|
@ -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<scheduler_operation> ops;
|
||||
|
||||
|
@ -49,7 +49,7 @@ strand_service::strand_service(asio::io_context& io_context)
|
||||
{
|
||||
}
|
||||
|
||||
void strand_service::shutdown_service()
|
||||
void strand_service::shutdown()
|
||||
{
|
||||
op_queue<operation> ops;
|
||||
|
||||
|
@ -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_);
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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_);
|
||||
|
@ -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_);
|
||||
|
||||
|
@ -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_);
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -43,7 +43,7 @@ public:
|
||||
}
|
||||
|
||||
// Destroy all user-defined handler objects owned by the service.
|
||||
void shutdown_service()
|
||||
void shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
}
|
||||
|
||||
// Destroy all user-defined handler objects owned by the service.
|
||||
void shutdown_service()
|
||||
void shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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<operation>& ops);
|
||||
|
||||
private:
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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<operation>& ops);
|
||||
|
||||
// Called after starting an overlapped I/O operation that did not complete
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
}
|
||||
|
||||
// Destroy all user-defined handler objects owned by the service.
|
||||
void shutdown_service()
|
||||
void shutdown()
|
||||
{
|
||||
if (--outstanding_ops_ > 0)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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&);
|
||||
|
@ -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.
|
||||
|
@ -83,8 +83,8 @@ namespace detail { class service_registry; }
|
||||
* type.
|
||||
*
|
||||
* On destruction, a class that is derived from execution_context must perform
|
||||
* <tt>execution_context::shutdown_context()</tt> followed by
|
||||
* <tt>execution_context::destroy_context()</tt>.
|
||||
* <tt>execution_context::shutdown()</tt> followed by
|
||||
* <tt>execution_context::destroy()</tt>.
|
||||
*
|
||||
* 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
|
||||
* <tt>delete static_cast<execution_context::service*>(svc)</tt>.
|
||||
*/
|
||||
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 <tt>svc->fork_service();</tt>. When processing the fork_prepare
|
||||
* performs <tt>svc->notify_fork();</tt>. 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;
|
||||
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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.
|
||||
/**
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -52,7 +52,7 @@ public:
|
||||
}
|
||||
|
||||
/// Destroy all user-defined handler objects owned by the service.
|
||||
void shutdown_service()
|
||||
void shutdown()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void shutdown_service()
|
||||
virtual void shutdown()
|
||||
{
|
||||
for (auto& t : threads_)
|
||||
t.join();
|
||||
|
@ -38,7 +38,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
virtual void shutdown_service()
|
||||
virtual void shutdown()
|
||||
{
|
||||
for (auto& t : threads_)
|
||||
t.join();
|
||||
|
Loading…
Reference in New Issue
Block a user