Contur 2
Educational OS kernel simulator
Loading...
Searching...
No Matches
dispatcher_pool.h
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <cstdint>
7#include <memory>
8#include <vector>
9
12
13namespace contur {
14
38 class DispatcherPool final : public IDispatchRuntime
39 {
40 public:
44
46 ~DispatcherPool() override;
47
49 DispatcherPool(const DispatcherPool &) = delete;
50
55
57 DispatcherPool &operator=(DispatcherPool &&) noexcept;
58
60 [[nodiscard]] std::string_view name() const noexcept override;
61
63 [[nodiscard]] const HostThreadingConfig &config() const noexcept override;
64
66 [[nodiscard]] Result<void> dispatch(const DispatcherLanes &lanes, std::size_t tickBudget) override;
67
69 void tick(const DispatcherLanes &lanes) override;
70
72 [[nodiscard]] std::uint64_t lastEpoch() const noexcept;
73
75 [[nodiscard]] std::vector<std::size_t> lastDeterministicOrder() const;
76
78 [[nodiscard]] std::vector<TraceEvent> lastTraceEvents() const;
79
80 private:
81 struct Impl;
82 std::unique_ptr<Impl> impl_;
83 };
84
85} // namespace contur
DispatcherPool(DispatcherPool &&) noexcept
Move-constructs pool runtime state.
void tick(const DispatcherLanes &lanes) override
Ticks lanes using pooled workers.
std::unique_ptr< Impl > impl_
std::vector< TraceEvent > lastTraceEvents() const
Runtime trace metadata emitted by the last dispatch/tick pass.
std::string_view name() const noexcept override
Returns runtime implementation name.
const HostThreadingConfig & config() const noexcept override
Returns runtime-owned normalized threading config.
DispatcherPool(HostThreadingConfig config={})
Constructs a worker pool runtime.
~DispatcherPool() override
Destroys pool runtime and joins worker threads.
DispatcherPool & operator=(const DispatcherPool &)=delete
Copy assignment is disabled.
std::uint64_t lastEpoch() const noexcept
Last completed runtime epoch identifier.
std::vector< std::size_t > lastDeterministicOrder() const
Stable lane order used by deterministic dispatch mode.
Result< void > dispatch(const DispatcherLanes &lanes, std::size_t tickBudget) override
Runs one pooled dispatch pass across all lanes.
DispatcherPool(const DispatcherPool &)=delete
Copy construction is disabled.
Strategy interface that executes dispatch/tick across dispatcher lanes.
A result type that holds either a success value of type T or an ErrorCode.
Definition error.h:104
Runtime strategy interface for dispatching across dispatcher lanes.
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.
Structured trace event record.
Definition trace_event.h:21
Structured trace event record shared by tracing components.