| Home | Libraries | People | FAQ | More

#### thread_pool::add_service

Inherited from execution_context.

(Deprecated: Use `make_service()`.) Add a service object to the `execution_context`.

    template<
        typename Service>
    friend 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/thread_pool.hpp`

Convenience header: `boost/asio.hpp`