Doxygen
|
Class managing a pool of worker threads. 更多...
#include <threadpool.h>
Public 成员函数 | |
ThreadPool (std::size_t N=1) | |
start N threads in the thread pool. 更多... | |
~ThreadPool () | |
deletes the thread pool by finishing all threads 更多... | |
template<class F , class R = std::result_of_t<F&()>> | |
std::future< R > | queue (F &&f) |
Queue the callable function f for the threads to execute. 更多... | |
void | finish () |
finish enques a "stop the thread" message for every thread, then waits for them to finish 更多... | |
Private 成员函数 | |
template<typename ... Args> | |
void | unused_variable (Args &&...args) |
void | threadTask () |
Private 属性 | |
std::mutex | m_mutex |
std::condition_variable | m_cond |
std::deque< std::function< void()> > | m_work |
std::vector< std::future< void > > | m_finished |
Class managing a pool of worker threads.
Work can be queued by passing a function to queue(). A future will be returned that can be used to obtain the result of the function after execution.
Usage example:
在文件 threadpool.h 第 47 行定义.
|
inline |
|
inline |
deletes the thread pool by finishing all threads
在文件 threadpool.h 第 78 行定义.
|
inline |
finish enques a "stop the thread" message for every thread, then waits for them to finish
在文件 threadpool.h 第 108 行定义.
被这些函数引用 ThreadPool().
|
inline |
Queue the callable function f for the threads to execute.
A future of the return type of the function is returned to capture the result.
在文件 threadpool.h 第 86 行定义.
被这些函数引用 generateClassList(), generateFileDocs(), generateFileSources(), generateNamespaceClassDocs() , 以及 parseFilesMultiThreading().
|
inlineprivate |
在文件 threadpool.h 第 128 行定义.
|
inlineprivate |
|
private |
在文件 threadpool.h 第 154 行定义.
被这些函数引用 unused_variable().
|
private |
在文件 threadpool.h 第 160 行定义.
|
private |
在文件 threadpool.h 第 153 行定义.
|
private |
在文件 threadpool.h 第 157 行定义.
被这些函数引用 unused_variable().