CARLA
 
载入中...
搜索中...
未找到
Public 成员函数 | Private 属性 | 所有成员列表
carla::ThreadPool类 参考

A thread pool based on Boost.Asio's io context. 更多...

#include <ThreadPool.h>

+ 类 carla::ThreadPool 继承关系图:
+ carla::ThreadPool 的协作图:

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
 
NonCopyableoperator= (const NonCopyable &)=delete
 
NonCopyableoperator= (NonCopyable &&)=delete
 

详细描述

A thread pool based on Boost.Asio's io context.

在文件 ThreadPool.h24 行定义.

构造及析构函数说明

◆ ThreadPool()

carla::ThreadPool::ThreadPool ( )
inline

在文件 ThreadPool.h27 行定义.

◆ ~ThreadPool()

carla::ThreadPool::~ThreadPool ( )
inline

Stops the ThreadPool and joins all its threads.

在文件 ThreadPool.h30 行定义.

引用了 Stop().

+ 函数调用图:

成员函数说明

◆ AsyncRun() [1/2]

void carla::ThreadPool::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.h56 行定义.

引用了 AsyncRun().

被这些函数引用 AsyncRun().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ AsyncRun() [2/2]

void carla::ThreadPool::AsyncRun ( size_t worker_threads)
inline

Launch threads to run tasks asynchronously.

Launch specific number of threads if worker_threads is provided, otherwise use all available hardware concurrency.

在文件 ThreadPool.h51 行定义.

引用了 _workers, carla::ThreadGroup::CreateThreads() , 以及 Run().

被这些函数引用 carla::multigpu::Router::AsyncRun(), carla::streaming::Client::AsyncRun(), carla::streaming::Server::AsyncRun(), TEST() , 以及 TEST().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ io_context()

auto & carla::ThreadPool::io_context ( )
inline

Return the underlying io_context.

在文件 ThreadPool.h35 行定义.

引用了 _io_context.

被这些函数引用 carla::multigpu::Router::Router() , 以及 carla::streaming::Client::Subscribe().

+ 这是这个函数的调用关系图:

◆ Post()

template<typename FunctorT , typename ResultT = typename std::result_of<FunctorT()>::type>
std::future< ResultT > carla::ThreadPool::Post ( FunctorT && functor)
inline

Post a task to the pool.

在文件 ThreadPool.h41 行定义.

引用了 _io_context , 以及 carla::MoveHandler().

被这些函数引用 TEST() , 以及 TEST().

+ 函数调用图:
+ 这是这个函数的调用关系图:

◆ Run()

void carla::ThreadPool::Run ( )
inline

Run tasks in this thread.

警告
This function blocks until the ThreadPool has been stopped.

在文件 ThreadPool.h63 行定义.

引用了 _io_context.

被这些函数引用 AsyncRun(), carla::streaming::Client::Run() , 以及 carla::streaming::Server::Run().

+ 这是这个函数的调用关系图:

◆ RunFor()

void carla::ThreadPool::RunFor ( time_duration duration)
inline

Run tasks in this thread for an specific duration.

警告
This function blocks until the ThreadPool has been stopped, or until the specified time duration has elapsed.

在文件 ThreadPool.h71 行定义.

引用了 _io_context , 以及 carla::time_duration::to_chrono().

+ 函数调用图:

◆ Stop()

void carla::ThreadPool::Stop ( )
inline

Stop the ThreadPool and join all its threads.

在文件 ThreadPool.h76 行定义.

引用了 _io_context, _workers , 以及 carla::ThreadGroup::JoinAll().

被这些函数引用 carla::multigpu::Router::Stop(), carla::streaming::Client::~Client(), carla::multigpu::Secondary::~Secondary(), carla::streaming::Server::~Server() , 以及 ~ThreadPool().

+ 函数调用图:
+ 这是这个函数的调用关系图:

类成员变量说明

◆ _io_context

boost::asio::io_context carla::ThreadPool::_io_context
private

在文件 ThreadPool.h83 行定义.

被这些函数引用 io_context(), Post(), Run(), RunFor() , 以及 Stop().

◆ _work_to_do

boost::asio::io_context::work carla::ThreadPool::_work_to_do
private

在文件 ThreadPool.h85 行定义.

◆ _workers

ThreadGroup carla::ThreadPool::_workers
private

在文件 ThreadPool.h87 行定义.

被这些函数引用 AsyncRun() , 以及 Stop().


该类的文档由以下文件生成: