Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
protected_job.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
12#pragma once
13
14#include <kcenon/common/resilience/circuit_breaker.h>
16
17#include <memory>
18
19namespace kcenon::thread
20{
21 using common::resilience::circuit_breaker;
22
46 class protected_job : public job
47 {
48 public:
55 std::unique_ptr<job> inner,
56 std::shared_ptr<circuit_breaker> cb);
57
61 ~protected_job() override;
62
73 auto do_work() -> common::VoidResult override;
74
79 [[nodiscard]] auto get_name() const -> std::string;
80
81 private:
82 std::unique_ptr<job> inner_;
83 std::shared_ptr<circuit_breaker> cb_;
84 };
85
86} // namespace kcenon::thread
Represents a unit of work (task) to be executed, typically by a job queue.
Definition job.h:136
A job wrapper that integrates circuit breaker protection.
std::shared_ptr< circuit_breaker > cb_
~protected_job() override
Destructor.
auto do_work() -> common::VoidResult override
Executes the wrapped job with circuit breaker protection.
auto get_name() const -> std::string
Gets the name of this job.
protected_job(std::unique_ptr< job > inner, std::shared_ptr< circuit_breaker > cb)
Constructs a protected job wrapper.
std::unique_ptr< job > inner_
Base job class for schedulable work units in the thread system.
Core threading foundation of the thread system library.
Definition thread_impl.h:17
STL namespace.