Maria GDK 5.1.0.49
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::ThreadPool Class Reference

#include <StkThreadPool.h>

Public Member Functions

 ThreadPool (size_t threads=std::thread::hardware_concurrency())
 
void stop ()
 
template<class F , class... Args>
auto enqueue (F &&f, Args &&... args)
 

Detailed Description

ThreadPool - Minimal thread pool with queue

Member Function Documentation

◆ enqueue()

template<class F , class... Args>
auto STK::ThreadPool::enqueue ( F &&  f,
Args &&...  args 
)
inline

Enqueue a task as a lambda or function. Returns a future with the results:

auto fut = pool.enqueue([] {
   return 42;
});

EXPECT_EQ(fut.get(), 42);

◆ stop()

void STK::ThreadPool::stop ( )
inline

Stop the queue processing. Normally done in the destructor, but may be called explicitly for improved control.


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