A thread pool based on Boost.Asio's io context. 更多...
#include <ThreadPool.h>
Public 成员函数 | |
void | AsyncRun () |
Launch threads to run tasks asynchronously. | |
void | AsyncRun (size_t worker_threads) |
Launch threads to run tasks asynchronously. | |
auto & | io_context () |
Return the underlying io_context. | |
template<typename FunctorT , typename ResultT = typename std::result_of<FunctorT()>::type> | |
std::future< ResultT > | Post (FunctorT &&functor) |
Post a task to the pool. | |
void | Run () |
Run tasks in this thread. | |
void | RunFor (time_duration duration) |
Run tasks in this thread for an specific duration. | |
void | Stop () |
Stop the ThreadPool and join all its threads. | |
ThreadPool () | |
~ThreadPool () | |
Stops the ThreadPool and joins all its threads. | |
Private 属性 | |
boost::asio::io_context | _io_context |
boost::asio::io_context::work | _work_to_do |
ThreadGroup | _workers |
额外继承的成员函数 | |
Private 成员函数 继承自 carla::NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
NonCopyable (NonCopyable &&)=delete | |
NonCopyable & | operator= (const NonCopyable &)=delete |
NonCopyable & | operator= (NonCopyable &&)=delete |
A thread pool based on Boost.Asio's io context.
在文件 ThreadPool.h 第 24 行定义.
|
inline |
在文件 ThreadPool.h 第 27 行定义.
|
inline |
|
inline |
Launch threads to run tasks asynchronously.
Launch specific number of threads if worker_threads is provided, otherwise use all available hardware concurrency.
在文件 ThreadPool.h 第 56 行定义.
引用了 AsyncRun().
被这些函数引用 AsyncRun().
|
inline |
Launch threads to run tasks asynchronously.
Launch specific number of threads if worker_threads is provided, otherwise use all available hardware concurrency.
在文件 ThreadPool.h 第 51 行定义.
引用了 _workers, carla::ThreadGroup::CreateThreads() , 以及 Run().
被这些函数引用 carla::multigpu::Router::AsyncRun(), carla::streaming::Client::AsyncRun(), carla::streaming::Server::AsyncRun(), TEST() , 以及 TEST().
|
inline |
Return the underlying io_context.
在文件 ThreadPool.h 第 35 行定义.
引用了 _io_context.
被这些函数引用 carla::multigpu::Router::Router() , 以及 carla::streaming::Client::Subscribe().
|
inline |
Post a task to the pool.
在文件 ThreadPool.h 第 41 行定义.
引用了 _io_context , 以及 carla::MoveHandler().
|
inline |
Run tasks in this thread.
在文件 ThreadPool.h 第 63 行定义.
引用了 _io_context.
被这些函数引用 AsyncRun(), carla::streaming::Client::Run() , 以及 carla::streaming::Server::Run().
|
inline |
Run tasks in this thread for an specific duration.
在文件 ThreadPool.h 第 71 行定义.
引用了 _io_context , 以及 carla::time_duration::to_chrono().
|
inline |
Stop the ThreadPool and join all its threads.
在文件 ThreadPool.h 第 76 行定义.
引用了 _io_context, _workers , 以及 carla::ThreadGroup::JoinAll().
被这些函数引用 carla::multigpu::Router::Stop(), carla::streaming::Client::~Client(), carla::multigpu::Secondary::~Secondary(), carla::streaming::Server::~Server() , 以及 ~ThreadPool().
|
private |
在文件 ThreadPool.h 第 83 行定义.
被这些函数引用 io_context(), Post(), Run(), RunFor() , 以及 Stop().
|
private |
在文件 ThreadPool.h 第 85 行定义.
|
private |
在文件 ThreadPool.h 第 87 行定义.
被这些函数引用 AsyncRun() , 以及 Stop().