Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
i_dispatch_runtime.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstddef>
7#include <functional>
8#include <string_view>
9#include <vector>
10
11#include "contur/core/error.h"
12
14
15namespace contur {
16
17 class IDispatcher;
18
20 using DispatcherLanes = std::vector<std::reference_wrapper<IDispatcher>>;
21
24 {
25 public:
26 virtual ~IDispatchRuntime() = default;
27
29 [[nodiscard]] virtual std::string_view name() const noexcept = 0;
30
32 [[nodiscard]] virtual const HostThreadingConfig &config() const noexcept = 0;
33
38 [[nodiscard]] virtual Result<void> dispatch(const DispatcherLanes &lanes, std::size_t tickBudget) = 0;
39
42 virtual void tick(const DispatcherLanes &lanes) = 0;
43 };
44
45} // namespace contur
Strategy interface that executes dispatch/tick across dispatcher lanes.
virtual std::string_view name() const noexcept=0
Returns runtime implementation name.
virtual const HostThreadingConfig & config() const noexcept=0
Returns the normalized runtime-owned threading config.
virtual ~IDispatchRuntime()=default
virtual void tick(const DispatcherLanes &lanes)=0
Advances all lanes by one runtime tick.
virtual Result< void > dispatch(const DispatcherLanes &lanes, std::size_t tickBudget)=0
Runs one dispatch cycle across provided lanes.
Interface for process lifecycle dispatch orchestration.
A result type that holds either a success value of type T or an ErrorCode.
Definition error.h:104
Error codes and Result<T> type for fallible operations.
Definition block.h:15
std::vector< std::reference_wrapper< IDispatcher > > DispatcherLanes
Alias for the dispatcher lanes controlled by a runtime.
Configuration for host-thread dispatch runtime behavior.
Runtime-owned host threading configuration for dispatch runtimes.