cppmicroservices-asyncworkservice - Man Page

CppMicroServices Asynchronous Work Service API

Asyncworkservice

class AsyncWorkService

#include <cppmicroservices/asyncworkservice/AsyncWorkService.hpp>

Provides a method which controls how DeclarativeServices internally schedules asynchronous work.

Creating an AsyncWorkService implementation is not required; this is intended to be used in specialty situations where the client application has requirements that the default asynchronous work scheduling mechanism does not conform to.

Remark

This class is thread safe.

Public Functions

virtual ~AsyncWorkService()

virtual void post(std::packaged_task<void()> &&task) = 0

Run a std::packaged_task<void()> (optionally on another thread asynchronously).

The std::future<void> associated with the std::packaged_task<void()> task object will contain the result from the task object.

NOTE:

The caller is required to manage the std::future<void> associated with the std::packaged_task<void()> in order to wait on the async task.

Parameters

task -- A std::packaged_task<void()> wrapping a Callable target to execute asynchronously.

Author

CppMicroServices Team

Info

Feb 05, 2025 3.8.5 C++ Micro Services