11 #ifndef ASIO_EXECUTION_CONTEXT_HPP 12 #define ASIO_EXECUTION_CONTEXT_HPP 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 18 #include "asio/detail/config.hpp" 22 #include "asio/detail/noncopyable.hpp" 23 #include "asio/detail/variadic_templates.hpp" 25 #include "asio/detail/push_options.hpp" 29 class execution_context;
32 #if !defined(GENERATING_DOCUMENTATION) 33 template <
typename Service> Service& use_service(execution_context&);
34 template <
typename Service> Service& use_service(io_context&);
35 template <
typename Service>
void add_service(execution_context&, Service*);
36 template <
typename Service>
bool has_service(execution_context&);
37 #endif // !defined(GENERATING_DOCUMENTATION) 39 namespace detail {
class service_registry; }
117 ASIO_DECL ~execution_context();
128 ASIO_DECL
void shutdown();
138 ASIO_DECL
void destroy();
207 template <
typename Service>
208 friend Service& use_service(execution_context& e);
224 template <
typename Service>
227 #if defined(GENERATING_DOCUMENTATION) 241 template <
typename Service,
typename... Args>
242 friend Service& make_service(execution_context& e, Args&&... args);
244 #elif defined(ASIO_HAS_VARIADIC_TEMPLATES) 246 template <
typename Service,
typename... Args>
247 friend Service& make_service(execution_context& e,
248 ASIO_MOVE_ARG(Args)... args);
250 #else // defined(ASIO_HAS_VARIADIC_TEMPLATES) 252 template <
typename Service>
253 friend Service& make_service(execution_context& e);
255 #define ASIO_PRIVATE_MAKE_SERVICE_DEF(n) \ 256 template <typename Service, ASIO_VARIADIC_TPARAMS(n)> \ 257 friend Service& make_service(execution_context& e, \ 258 ASIO_VARIADIC_MOVE_PARAMS(n)); \ 260 ASIO_VARIADIC_GENERATE(ASIO_PRIVATE_MAKE_SERVICE_DEF)
261 #undef ASIO_PRIVATE_MAKE_SERVICE_DEF 263 #endif // defined(ASIO_HAS_VARIADIC_TEMPLATES) 284 template <
typename Service>
285 friend void add_service(execution_context& e, Service* svc);
297 template <
typename Service>
298 friend bool has_service(execution_context& e);
320 execution_context& context();
327 ASIO_DECL
service(execution_context& owner);
330 ASIO_DECL
virtual ~service();
334 virtual void shutdown() = 0;
342 ASIO_DECL
virtual void notify_fork(
348 key() : type_info_(0), id_(0) {}
349 const std::type_info* type_info_;
353 execution_context& owner_;
360 :
public std::logic_error
369 :
public std::logic_error
378 template <
typename Type>
385 template <
typename Type>
399 template <
typename Type>
405 #include "asio/detail/pop_options.hpp" 407 #include "asio/impl/execution_context.hpp" 408 #if defined(ASIO_HEADER_ONLY) 409 # include "asio/impl/execution_context.ipp" 410 #endif // defined(ASIO_HEADER_ONLY) 412 #endif // ASIO_EXECUTION_CONTEXT_HPP id()
Constructor.
Definition: execution_context.hpp:311
Definition: noncopyable.hpp:25
Class used to uniquely identify a service.
Definition: execution_context.hpp:306
Definition: execution_context.hpp:386
Base class for all io_context services.
Definition: execution_context.hpp:315
Definition: service_registry.hpp:36
A context for function object execution.
Definition: execution_context.hpp:105
Provides core I/O functionality.
Definition: io_context.hpp:211
Notify the context that the process is about to fork.
Definition: execution_context.hpp:145
Exception thrown when trying to add a duplicate service to an execution_context.
Definition: execution_context.hpp:359
Exception thrown when trying to add a service object to an execution_context where the service has a ...
Definition: execution_context.hpp:368
fork_event
Fork-related event notifications.
Definition: execution_context.hpp:142
Notify the context that the process has forked and is the parent.
Definition: execution_context.hpp:148
Definition: any_io_executor.hpp:28
Definition: execution_context.hpp:379