ThreadSchedule
3.0.0
Modern C++ thread management library
Loading...
Searching...
No Matches
detail/pool/worker_count.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <algorithm>
4
#include <cstddef>
5
#include <stdexcept>
6
#include <thread>
7
8
namespace
threadschedule::detail
9
{
10
11
[[nodiscard]]
inline
auto
12
default_worker_count
() noexcept ->
std
::
size_t
13
{
14
return
(std::max)(std::size_t{ 1 },
static_cast<
std::size_t
>
(std::thread::hardware_concurrency()));
15
}
16
17
[[nodiscard]]
inline
auto
18
checked_worker_count
(std::size_t count) -> std::size_t
19
{
20
if
(count == 0)
21
throw
std::invalid_argument(
"worker count must be positive"
);
22
return
count;
23
}
24
25
}
// namespace threadschedule::detail
std
Definition
thread_id.hpp:101
threadschedule::detail
Aggregates multiple thread_registry_backend instances into a single queryable view.
Definition
native_thread.hpp:20
threadschedule::detail::default_worker_count
auto default_worker_count() noexcept -> std::size_t
Definition
detail/pool/worker_count.hpp:12
threadschedule::detail::checked_worker_count
auto checked_worker_count(std::size_t count) -> std::size_t
Definition
detail/pool/worker_count.hpp:18
include
threadschedule
detail
pool
worker_count.hpp
Generated by
1.9.8