API to help write async code.This API is based around jobs that take lambdas to execute asynchronous tasks. Each async operation can take a continuation that can then be used to execute further async operations. That way it is possible to build async chains of operations that can be stored and executed later on. Jobs can be composed, similarly to functions.

Relations between the components:

  • Job: API wrapper around Executors chain. Can be destroyed while still running, because the actual execution happens in the background
  • Executor: Describes task to execute. Executors form a linked list matching the order in which they will be executed. The Executor chain is destroyed when the parent Job is destroyed. However if the Job is still running it is guaranteed that the Executor chain will not be destroyed until the execution is finished.
  • Execution: The running execution of the task stored in Executor. Each call to Job::exec() instantiates new Execution chain, which makes it possible for the Job to be executed multiple times (even in parallel).
  • Future: Representation of the result that is being calculated

TODO: Possibility to abort a job through future (perhaps optional?) TODO: Support for timeout, specified during exec call, after which the error handler gets called with a defined errorCode.

This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sat Sep 30 2023 03:59:33 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.