1// 2// impl/execution_context.ipp 3// ~~~~~~~~~~~~~~~~~~~~~~~~~~ 4// 5// Copyright (c) 2003-2020 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6// 7// Distributed under the Boost Software License, Version 1.0. (See accompanying 8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 9// 10 11#ifndef BOOST_ASIO_IMPL_EXECUTION_CONTEXT_IPP 12#define BOOST_ASIO_IMPL_EXECUTION_CONTEXT_IPP 13 14#if defined(_MSC_VER) && (_MSC_VER >= 1200) 15# pragma once 16#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18#include <boost/asio/detail/config.hpp> 19#include <boost/asio/execution_context.hpp> 20#include <boost/asio/detail/service_registry.hpp> 21 22#include <boost/asio/detail/push_options.hpp> 23 24namespace boost { 25namespace asio { 26 27execution_context::execution_context() 28 : service_registry_(new boost::asio::detail::service_registry(*this)) 29{ 30} 31 32execution_context::~execution_context() 33{ 34 shutdown(); 35 destroy(); 36 delete service_registry_; 37} 38 39void execution_context::shutdown() 40{ 41 service_registry_->shutdown_services(); 42} 43 44void execution_context::destroy() 45{ 46 service_registry_->destroy_services(); 47} 48 49void execution_context::notify_fork( 50 boost::asio::execution_context::fork_event event) 51{ 52 service_registry_->notify_fork(event); 53} 54 55execution_context::service::service(execution_context& owner) 56 : owner_(owner), 57 next_(0) 58{ 59} 60 61execution_context::service::~service() 62{ 63} 64 65void execution_context::service::notify_fork(execution_context::fork_event) 66{ 67} 68 69service_already_exists::service_already_exists() 70 : std::logic_error("Service already exists.") 71{ 72} 73 74invalid_service_owner::invalid_service_owner() 75 : std::logic_error("Invalid service owner.") 76{ 77} 78 79} // namespace asio 80} // namespace boost 81 82#include <boost/asio/detail/pop_options.hpp> 83 84#endif // BOOST_ASIO_IMPL_EXECUTION_CONTEXT_IPP 85