class EE::Executor

Overview

Abstract destination for work items. More…

#include <executor.hpp>

class Executor {
public:
    // typedefs

    typedef SmallUniqueFunction<void(), FunctionInlineSize> Function;

    // fields

    static constexpr std::size_t FunctionInlineSize = 64;

    // construction

    virtual ~Executor();

    // methods

    virtual void execute(Function function) = 0;
};

Detailed Documentation

Abstract destination for work items.

Core code schedules continuations through this interface without knowing whether they run on a thread pool, the UI thread, an I/O thread, or inline. Implementations must run every accepted function exactly once, unless the executor is being destroyed, in which case pending functions may be destroyed without running (their owned state, such as task resolvers, is then released normally).

Fields

static constexpr std::size_t FunctionInlineSize = 64

Inline capacity of an executor work item. Continuations that capture a callable, a task source and a task state fit without a heap allocation.