#include <thread_pool.h>
◆ ThreadPoolWorker() [1/2]
| apollo::perception::lib::ThreadPoolWorker::ThreadPoolWorker |
( |
ThreadPool * |
thread_pool | ) |
|
|
inlineexplicit |
在文件 thread_pool.h 第 65 行定义.
66 :
Thread(
true,
"ThreadPoolWorker"), thread_pool_(thread_pool) {}
Thread(bool joinable=false, const std::string &name="Thread")
◆ ~ThreadPoolWorker()
| virtual apollo::perception::lib::ThreadPoolWorker::~ThreadPoolWorker |
( |
| ) |
|
|
inlinevirtual |
◆ ThreadPoolWorker() [2/2]
| apollo::perception::lib::ThreadPoolWorker::ThreadPoolWorker |
( |
const ThreadPoolWorker & |
| ) |
|
|
delete |
◆ operator=()
◆ Run()
| void apollo::perception::lib::ThreadPoolWorker::Run |
( |
| ) |
|
|
overrideprotectedvirtual |
实现了 apollo::perception::lib::Thread.
在文件 thread_pool.cc 第 69 行定义.
69 {
70 while (true) {
71 Closure *closure = nullptr;
72 thread_pool_->task_queue_.
Pop(&closure);
73 if (closure == nullptr) {
74 break;
75 }
76
77 {
78 MutexLock lock(&(thread_pool_->mutex_));
79 --(thread_pool_->num_available_workers_);
80 }
81
82 closure->Run();
83
84 {
85 MutexLock lock(&(thread_pool_->mutex_));
86 ++(thread_pool_->num_available_workers_);
87 }
88 }
89}
virtual void Pop(Data *data)
该类的文档由以下文件生成: