boost::capy::execution_context::service

Abstract base class for services owned by an execution context.

Synopsis

class service;

Description

Services provide extensible functionality to an execution context. Each service type can be registered at most once. Services are created via use_service() or make_service() and are owned by the execution context for their lifetime.

Derived classes must implement the pure virtual shutdown() member function, which is called when the owning execution context is being destroyed. The shutdown() function should release resources and cancel outstanding operations without blocking.

Deriving from service

  • Implement `shutdown()` to perform cleanup.

  • Accept `execution_context&` as the first constructor parameter.

  • Optionally define `key_type` to enable base‐class lookup.

Example

struct my_service : execution_context::service
{
    explicit my_service(execution_context&) {}

protected:
    void shutdown() override
    {
        // Cancel pending operations, release resources
    }
};

Member Functions

Name

Description

~service [destructor] [virtual]

Destructor

Protected Member Functions

Name

Description

service [constructor]

Default constructor

shutdown [virtual]

Called when the owning execution context shuts down.

Friends

Name Description

boost::capy::execution_context

Base class for I/O object containers providing service management.

See Also

execution_context

Created with MrDocs