Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

add_service

template<
    typename Service>
void add_service(
    execution_context & e,
    Service * svc);

This function is used to add a service to the execution_context.

Parameters

e

The execution_context object that owns the service.

svc

The service object. On success, ownership of the service object is transferred to the execution_context. When the execution_context object is destroyed, it will destroy the service object by performing:

delete static_cast<execution_context::service*>(svc)

Exceptions

boost::asio::service_already_exists

Thrown if a service of the given type is already present in the execution_context.

boost::asio::invalid_service_owner

Thrown if the service's owning execution_context is not the execution_context object specified by the e parameter.

Requirements

Header: boost/asio/impl/execution_context.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext