CUBRID Engine  latest
cubthread::worker_pool< Context > Class Template Reference

#include <thread_manager.hpp>

Collaboration diagram for cubthread::worker_pool< Context >:
Collaboration graph

Classes

class  core
 

Public Types

using context_type = Context
 
using task_type = task< Context >
 
using context_manager_type = context_manager< Context >
 

Public Member Functions

 worker_pool (std::size_t pool_size, std::size_t task_max_count, context_manager_type &context_mgr, const char *name, std::size_t core_count=1, bool debug_logging=false, bool pool_threads=false, wait_seconds wait_for_task_time=std::chrono::seconds(5))
 
 ~worker_pool ()
 
bool try_execute (task_type *work_arg)
 
void execute (task_type *work_arg)
 
void execute_on_core (task_type *work_arg, std::size_t core_hash)
 
void stop_execution (void)
 
void start_all_workers (void)
 
bool is_running (void) const
 
bool is_full (void) const
 
std::size_t get_max_count (void) const
 
std::size_t get_core_count (void) const
 
void get_stats (cubperf::stat_value *stats_out) const
 
void er_log_stats (void) const
 
bool is_pooling_threads () const
 
const wait_secondsget_wait_for_task_time () const
 
template<typename Func , typename... Args>
void map_running_contexts (Func &&func, Args &&...args)
 
template<typename Func , typename... Args>
void map_cores (Func &&func, Args &&...args)
 

Private Types

using atomic_context_ptr = std::atomic< context_type * >
 

Private Member Functions

std::size_t get_round_robin_core_hash (void)
 

Private Attributes

std::size_t m_max_workers
 
std::size_t m_task_max_count
 
std::atomic< std::size_t > m_task_count
 
context_manager_typem_context_manager
 
corem_core_array
 
std::size_t m_core_count
 
std::atomic< std::size_t > m_round_robin_counter
 
std::atomic< boolm_stopped
 
bool m_log
 
bool m_pool_threads
 
wait_seconds m_wait_for_task_time
 
std::string m_name
 

Friends

class core
 

Detailed Description

template<typename Context>
class cubthread::worker_pool< Context >

Definition at line 59 of file thread_manager.hpp.

Member Typedef Documentation

template<typename Context>
using cubthread::worker_pool< Context >::atomic_context_ptr = std::atomic<context_type *>
private

Definition at line 227 of file thread_worker_pool.hpp.

template<typename Context>
using cubthread::worker_pool< Context >::context_manager_type = context_manager<Context>

Definition at line 139 of file thread_worker_pool.hpp.

template<typename Context>
using cubthread::worker_pool< Context >::context_type = Context

Definition at line 137 of file thread_worker_pool.hpp.

template<typename Context>
using cubthread::worker_pool< Context >::task_type = task<Context>

Definition at line 138 of file thread_worker_pool.hpp.

Constructor & Destructor Documentation

Member Function Documentation

template<typename Context >
void cubthread::worker_pool< Context >::er_log_stats ( void  ) const
template<typename Context >
void cubthread::worker_pool< Context >::execute ( task_type work_arg)
template<typename Context >
void cubthread::worker_pool< Context >::execute_on_core ( task_type work_arg,
std::size_t  core_hash 
)
template<typename Context >
std::size_t cubthread::worker_pool< Context >::get_core_count ( void  ) const
template<typename Context >
std::size_t cubthread::worker_pool< Context >::get_round_robin_core_hash ( void  )
private
template<typename Context >
bool cubthread::worker_pool< Context >::is_full ( void  ) const
inline
template<typename Context>
bool cubthread::worker_pool< Context >::is_pooling_threads ( ) const
inline
template<typename Context >
bool cubthread::worker_pool< Context >::is_running ( void  ) const
template<typename Context >
template<typename Func , typename... Args>
void cubthread::worker_pool< Context >::map_cores ( Func &&  func,
Args &&...  args 
)
template<typename Context >
template<typename Func , typename... Args>
void cubthread::worker_pool< Context >::map_running_contexts ( Func &&  func,
Args &&...  args 
)
template<typename Context >
void cubthread::worker_pool< Context >::start_all_workers ( void  )
template<typename Context >
bool cubthread::worker_pool< Context >::try_execute ( task_type work_arg)

Definition at line 601 of file thread_worker_pool.hpp.

References cubthread::worker_pool< Context >::execute(), and cubthread::worker_pool< Context >::is_full().

Referenced by cubthread::manager::try_task().

Here is the caller graph for this function:

Friends And Related Function Documentation

template<typename Context>
friend class core
friend

Definition at line 230 of file thread_worker_pool.hpp.

Member Data Documentation

template<typename Context>
context_manager_type& cubthread::worker_pool< Context >::m_context_manager
private
template<typename Context>
bool cubthread::worker_pool< Context >::m_log
private
template<typename Context>
std::string cubthread::worker_pool< Context >::m_name
private
template<typename Context>
std::atomic<std::size_t> cubthread::worker_pool< Context >::m_round_robin_counter
private
template<typename Context>
std::size_t cubthread::worker_pool< Context >::m_task_max_count
private

Definition at line 239 of file thread_worker_pool.hpp.

Referenced by cubthread::worker_pool< Context >::is_full().

template<typename Context>
wait_seconds cubthread::worker_pool< Context >::m_wait_for_task_time
private

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