Common System 0.2.0
Common interfaces and patterns for system integration
Loading...
Searching...
No Matches
kcenon::common::concepts::ExecutorLike Concept Referenceexport

A type that satisfies the Executor interface requirements. More...

#include <callable.h>

Concept definition

template<typename T>
concept kcenon::common::concepts::ExecutorLike = requires(T t, std::unique_ptr<interfaces::IJob> job, bool wait) {
{ t.worker_count() } -> std::convertible_to<size_t>;
{ t.is_running() } -> std::convertible_to<bool>;
{ t.pending_tasks() } -> std::convertible_to<size_t>;
{ t.shutdown(wait) } -> std::same_as<void>;
}
A type that satisfies the Executor interface requirements.
Definition callable.h:217

Detailed Description

A type that satisfies the Executor interface requirements.

Types satisfying this concept can manage and execute jobs, providing status information and shutdown capabilities.

Example usage:

template<ExecutorLike E>
void run_with_executor(E& executor, std::unique_ptr<interfaces::IJob> job) {
if (executor.is_running()) {
executor.execute(std::move(job));
}
}

Definition at line 217 of file callable.h.