A global thread pool.
More...
#include <threadpool.h>
A global thread pool.
Definition at line 43 of file threadpool.h.
◆ ~threadpool()
| tools::threadpool::~threadpool |
( |
| ) |
|
Definition at line 49 of file threadpool.cpp.
52 const boost::unique_lock<boost::mutex> lock(mutex);
54 has_work.notify_all();
61 has_work.notify_all();
63 for (
size_t i = 0; i<threads.size(); i++) {
64 try { threads[i].join(); }
◆ get_max_concurrency()
| unsigned int tools::threadpool::get_max_concurrency |
( |
| ) |
const |
◆ getInstance()
| static threadpool& tools::threadpool::getInstance |
( |
| ) |
|
|
inlinestatic |
Definition at line 46 of file threadpool.h.
47 static threadpool instance;
◆ getNewForUnitTests()
| static threadpool* tools::threadpool::getNewForUnitTests |
( |
unsigned |
max_threads = 0 | ) |
|
|
inlinestatic |
Definition at line 50 of file threadpool.h.
51 return new threadpool(max_threads);
◆ submit()
| void tools::threadpool::submit |
( |
waiter * |
waiter, |
|
|
std::function< void()> |
f, |
|
|
bool |
leaf = false |
|
) |
| |
Definition at line 69 of file threadpool.cpp.
71 boost::unique_lock<boost::mutex> lock(mutex);
72 if (!leaf && ((active == max && !queue.empty()) || depth > 0)) {
85 queue.push_front({obj, f, leaf});
87 queue.push_back({obj, f, leaf});
88 has_work.notify_one();
#define CHECK_AND_ASSERT_THROW_MES(expr, message)
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/src/common/threadpool.h
- /home/abuild/rpmbuild/BUILD/electroneum-5.0.0.4/src/common/threadpool.cpp