JeVois  1.17
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
jevois::ThreadPool Class Reference

#include <jevois/Util/ThreadPool.H>

A thread pool with CPU affinity.

Thread pool with extra settings to enforce that passed tasks run on some particular cores. Used by JeVois-Pro Platform to enforce that machine vision tasks run on big cores (ARM A73) while non-critical tasks run on slower little cores (ARM A53).

Definition at line 46 of file ThreadPool.H.

Public Member Functions

 ThreadPool (unsigned int threads=std::thread::hardware_concurrency(), bool little=false)
 Constructor. More...
 
 ~ThreadPool ()
 Destructor. More...
 
template<typename Func , typename... Args, std::enable_if_t< std::is_invocable_v< Func &&, Args &&... >, bool > = true>
auto execute (Func &&func, Args &&... args) -> std::future< decltype(func(args...))>
 Execute a function and get a future. More...
 
auto getPoolSize () -> size_t
 Get the pool size. More...
 

Constructor & Destructor Documentation

◆ ThreadPool()

jevois::ThreadPool::ThreadPool ( unsigned int  threads = std::thread::hardware_concurrency(),
bool  little = false 
)

Constructor.

Definition at line 31 of file ThreadPool.C.

References execute(), LERROR, and LINFO.

◆ ~ThreadPool()

jevois::ThreadPool::~ThreadPool ( )

Destructor.

Definition at line 104 of file ThreadPool.C.

Member Function Documentation

◆ execute()

template<typename Func , typename... Args, std::enable_if_t< std::is_invocable_v< Func &&, Args &&... >, bool > = true>
auto jevois::ThreadPool::execute ( Func &&  func,
Args &&...  args 
) -> std::future< decltype(func(args...))>

Execute a function and get a future.

Referenced by ThreadPool().

◆ getPoolSize()

auto jevois::ThreadPool::getPoolSize ( ) -> size_t

Get the pool size.

Definition at line 116 of file ThreadPool.C.


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