Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
Loading...
Searching...
No Matches
submit_options.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
5#pragma once
6
16#include <string>
17#include <optional>
18#include <chrono>
19
20namespace kcenon::thread {
21
57 std::string name;
58
68 bool wait_all = false;
69
79 bool wait_any = false;
80
84 submit_options() = default;
85
90 explicit submit_options(std::string job_name) : name(std::move(job_name)) {}
91
97 static submit_options named(std::string job_name) {
98 submit_options opts;
99 opts.name = std::move(job_name);
100 return opts;
101 }
102
108 submit_options opts;
109 opts.wait_all = true;
110 return opts;
111 }
112
118 submit_options opts;
119 opts.wait_any = true;
120 return opts;
121 }
122};
123
124} // namespace kcenon::thread
Core threading foundation of the thread system library.
Definition thread_impl.h:17
STL namespace.
Options for submitting jobs to the thread pool.
submit_options()=default
Default constructor with all defaults.
static submit_options all()
Create options for wait_all batch operation.
bool wait_any
If true, return the first completed result.
submit_options(std::string job_name)
Construct with job name only.
bool wait_all
If true, wait for all tasks and return results directly.
std::string name
Optional name for the job (useful for debugging/tracing).
static submit_options named(std::string job_name)
Create options for a named job.
static submit_options any()
Create options for wait_any batch operation.