Caffe2 - C++ API
A deep learning, cross platform ML framework
Data Structures | Public Member Functions | Protected Member Functions | Protected Attributes
c10::ThreadPool Class Reference
Inheritance diagram for c10::ThreadPool:
c10::TaskThreadPoolBase c10::TaskThreadPool

Data Structures

struct  task_element_t
 

Public Member Functions

 ThreadPool (std::size_t pool_size, int numa_node_id=-1)
 
size_t size () const override
 
size_t numAvailable () const override
 The number of available (i.e. More...
 
bool inThreadPool () const override
 Check if the current thread is from the thread pool.
 
void run (const std::function< void()> &func) override
 
template<typename Task >
void runTaskWithID (Task task)
 
void waitWorkComplete ()
 Wait for queue to be empty.
 

Protected Member Functions

virtual void init_thread ()
 

Protected Attributes

std::queue< task_element_ttasks_
 
std::vector< std::thread > threads_
 
std::mutex mutex_
 
std::condition_variable condition_
 
std::condition_variable completed_
 
std::atomic_bool running_
 
bool complete_
 
std::size_t available_
 
std::size_t total_
 
int numa_node_id_
 

Detailed Description

Definition at line 41 of file thread_pool.h.

Member Function Documentation

size_t c10::ThreadPool::numAvailable ( ) const
overridevirtual

The number of available (i.e.

idle) threads in this thread pool.

Implements c10::TaskThreadPoolBase.

Definition at line 37 of file thread_pool.cpp.


The documentation for this class was generated from the following files: