AUI Framework  develop
Cross-platform base for C++ UI apps
Loading...
Searching...
No Matches
AThreadPool Class Reference

Thread pool implementation. More...

#include <AUI/Thread/AThreadPool.h>

Detailed Description

Constructor & Destructor Documentation

◆ AThreadPool()

AThreadPool::AThreadPool ( size_t size)
Parameters
sizethread count to initialize.

Member Function Documentation

> All members, including inherited

◆ parallel()

template<typename Iterator, typename Functor>
auto AThreadPool::parallel ( Iterator begin,
Iterator end,
Functor && functor )

Parallels work of some range, grouping tasks per thread (i.e. for 8 items on a 4-core processor each core will process 2 items)

Parameters
    
beginrange begin
endrange end
functora functor of the following signature:
Result(Iterator begin, Iterator end)
Returns
future set per thread (i.e. for 8 items on a 4-core processor there will be 4 futures)
Performance note
When this function is used to write to the source data it would not be L1-cache friendly. Consider writing results to another location.