vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::ThreadPool::Batch Class Reference

A run of tasks addressed by index, queued as one entry. More...

#include <thread_pool.h>

Public Member Functions

template<typename Fn>
 Batch (size_t count, const Fn &task)
 A batch of count tasks, each a call of task with its index.
template<typename Fn>
 Batch (size_t count, const Fn &&task)=delete
 Refused: a temporary task is gone before a worker reaches it.

Detailed Description

A run of tasks addressed by index, queued as one entry.

The task is borrowed, not copied, so a batch of any size allocates nothing. The batch and its task must outlive the matching waitForBatch().

Constructor & Destructor Documentation

◆ Batch()

template<typename Fn>
Vkm::Engine::ThreadPool::Batch::Batch ( size_t count,
const Fn & task )
inline

A batch of count tasks, each a call of task with its index.

Template Parameters
FnCallable taking a size_t index.
Parameters
countHow many indices, counted from 0.
taskCalled once per index, on a worker or in waitForBatch; borrowed, not copied.

The documentation for this class was generated from the following file: