|
Foundation
|
#include "AtomicQueue.hpp"#include "Thread.hpp"#include <algorithm>#include <array>#include <cmath>#include <iterator>#include <type_traits>Go to the source code of this file.
Classes | |
| struct | Foundation::Core::Job |
| Job interface for use with ThreadPool. More... | |
| struct | Foundation::Core::LambdaJob< Lambda, ReturnType, Args > |
| State-carrying lambda job for use with ThreadPool. More... | |
| struct | Foundation::Core::ParallelForJob< Fn > |
| Self-draining for-loop job used by ThreadPool::ParallelFor. More... | |
| struct | Foundation::Core::ParallelForAsyncState< Fn > |
| Heap-resident shared state for a non-blocking ThreadPool::ParallelForAsync. More... | |
| struct | Foundation::Core::ParallelForAsyncJob< Fn > |
| One worker of a ParallelForAsyncState: drains the shared cursor and, when it is the last running worker, satisfies the promise and frees the shared state. More... | |
| class | Foundation::Core::ThreadPool |
| Atomic, lock-free Thread Pool implementation with fixed bounds. More... | |
Namespaces | |
| namespace | Foundation |
| namespace | Foundation::Core |
| Lock-free atomic primitives and implementations of data structures. | |
Typedefs | |
| using | Foundation::Core::JobQueue = MPMCQueue< UniquePtr< Job > > |
| Backing job queue type for ThreadPool. | |
| using | Foundation::Core::JobQueues = std::array< JobQueue, kJobPriorityCount > |
Enumerations | |
| enum class | Foundation::Core::JobPriority : size_t { Foundation::Core::Low , Foundation::Core::Normal , Foundation::Core::High } |
| enum class | Foundation::Core::ExecutionPolicy { Foundation::Core::Seq , Foundation::Core::Par } |
| Runtime execution policy for ThreadPool::ParallelFor, mirroring std::execution's seq/par — but chosen at runtime, so a caller can downgrade to serial with a one-argument change (debugging, determinism, or tiny workloads) instead of a compile-time switch. More... | |
Functions | |
| template<typename Fn , typename Arg > | |
| void | Foundation::Core::ParallelForInvoke (Fn &fn, Arg &&arg, size_t workerId) |
Invokes a ThreadPool::ParallelFor body for one item, passing the worker id only if the functor accepts it. arg is the index (index form) or the dereferenced element (iterator form), so callers may write fn(x) or fn(x, workerId) as they like. | |
Variables | |
| constexpr size_t | Foundation::Core::kJobPriorityCount = static_cast<size_t>(JobPriority::High) + 1 |