|
ThreadSchedule 4.1.0
Modern C++ thread management library
|
Value type for pool worker count. More...
#include <worker_count.hpp>
Public Member Functions | |
| worker_count () noexcept=default | |
| Construct automatic worker count. | |
| worker_count (std::size_t value) | |
| Construct explicit worker count. | |
| constexpr auto | is_automatic () const noexcept -> bool |
| Return whether this instance uses automatic resolution. | |
| auto | resolve () const noexcept -> std::size_t |
| Resolve the effective worker count. | |
Static Public Member Functions | |
| static constexpr auto | automatic () noexcept -> worker_count |
| Create automatic worker count. | |
| static auto | create (std::size_t value) noexcept -> result< worker_count > |
| Create explicit worker count without exceptions. | |
Value type for pool worker count.
The special automatic value resolves to at least one worker using std::thread::hardware_concurrency().
Definition at line 24 of file worker_count.hpp.
|
defaultnoexcept |
Construct automatic worker count.
Referenced by automatic(), create(), and worker_count().
|
inlineexplicit |
Construct explicit worker count.
| value | Number of workers, must be > 0. |
| std::invalid_argument | if value is zero. |
Definition at line 34 of file worker_count.hpp.
References worker_count().
|
inlinestaticnodiscardconstexprnoexcept |
Create automatic worker count.
Definition at line 41 of file worker_count.hpp.
References worker_count().
Referenced by threadschedule::advanced::lightweight_pool::lightweight_pool(), threadschedule::advanced::polling_pool::polling_pool(), threadschedule::advanced::raw_scheduled_pool::raw_scheduled_pool(), threadschedule::advanced::raw_thread_pool::raw_thread_pool(), threadschedule::advanced::scheduled_lightweight_pool::scheduled_lightweight_pool(), threadschedule::advanced::scheduled_polling_pool::scheduled_polling_pool(), threadschedule::advanced::scheduled_work_stealing_pool::scheduled_work_stealing_pool(), and threadschedule::advanced::work_stealing_pool::work_stealing_pool().
|
inlinestaticnodiscardnoexcept |
Create explicit worker count without exceptions.
| value | Number of workers, must be > 0. |
errc::invalid_argument. Definition at line 52 of file worker_count.hpp.
References threadschedule::unexpected(), and worker_count().
|
inlinenodiscardconstexprnoexcept |
Return whether this instance uses automatic resolution.
Definition at line 61 of file worker_count.hpp.
Referenced by resolve().
|
inlinenodiscardnoexcept |
Resolve the effective worker count.
max(1, hardware_concurrency). Definition at line 71 of file worker_count.hpp.
References is_automatic().
Referenced by threadschedule::advanced::global_thread_pool::init(), and threadschedule::advanced::global_work_stealing_pool::init().