Definition at line 13 of file thread_pool.h.
|
using | Task = std::function< void(size_t)> |
|
|
| ThreadPool (size_t thread_count=0) |
| Creates a thread pool with the given number of threads (a value of 0 tries to autodetect the number of threads and uses that as a thread count).
|
|
| ~ThreadPool () |
|
size_t | get_thread_count () const |
|
void | push (Task &&fun) |
|
void | wait () |
|
#include <bvh/v2/thread_pool.h>
◆ Task
◆ ThreadPool()
bvh::v2::ThreadPool::ThreadPool |
( |
size_t |
thread_count = 0 | ) |
|
|
inline |
Creates a thread pool with the given number of threads (a value of 0 tries to autodetect the number of threads and uses that as a thread count).
Definition at line 19 of file thread_pool.h.
◆ ~ThreadPool()
bvh::v2::ThreadPool::~ThreadPool |
( |
| ) |
|
|
inline |
◆ get_thread_count()
size_t bvh::v2::ThreadPool::get_thread_count |
( |
| ) |
const |
|
inline |
◆ join()
void bvh::v2::ThreadPool::join |
( |
| ) |
|
|
inlineprivate |
◆ push()
void bvh::v2::ThreadPool::push |
( |
Task && |
fun | ) |
|
|
inline |
◆ start()
void bvh::v2::ThreadPool::start |
( |
size_t |
thread_count | ) |
|
|
inlineprivate |
◆ stop()
void bvh::v2::ThreadPool::stop |
( |
| ) |
|
|
inlineprivate |
◆ wait()
void bvh::v2::ThreadPool::wait |
( |
| ) |
|
|
inline |
◆ worker()
void bvh::v2::ThreadPool::worker |
( |
ThreadPool * |
pool, |
|
|
size_t |
thread_id |
|
) |
| |
|
inlinestaticprivate |
◆ avail_
std::condition_variable bvh::v2::ThreadPool::avail_ |
|
private |
◆ busy_count_
int bvh::v2::ThreadPool::busy_count_ = 0 |
|
private |
◆ done_
std::condition_variable bvh::v2::ThreadPool::done_ |
|
private |
◆ mutex_
std::mutex bvh::v2::ThreadPool::mutex_ |
|
private |
◆ should_stop_
bool bvh::v2::ThreadPool::should_stop_ = false |
|
private |
◆ tasks_
std::queue<Task> bvh::v2::ThreadPool::tasks_ |
|
private |
◆ threads_
std::vector<std::thread> bvh::v2::ThreadPool::threads_ |
|
private |
geom/geom/inc/bvh/v2/thread_pool.h