CUBRID Engine
latest
|
#include <thread_worker_pool.hpp>
Classes | |
class | worker |
Public Types | |
using | context_type = Context |
using | task_type = task< Context > |
using | worker_pool_type = worker_pool< Context > |
Public Member Functions | |
void | init_pool_and_workers (worker_pool< Context > &parent, std::size_t worker_count) |
void | execute_task (task_type *task_p) |
template<typename Func , typename... Args> | |
void | map_running_contexts (bool &stop, Func &&func, Args &&...args) const |
void | notify_stop (bool &is_not_stopped) |
void | retire_queued_tasks (void) |
void | start_all_workers (void) |
void | get_stats (cubperf::stat_value *sum_inout) const |
void | finished_task_notification (void) |
task_type * | get_task_or_become_available (worker &worker_arg) |
void | become_available (worker &worker_arg) |
void | check_worker_not_available (const worker &worker_arg) |
context_manager< context_type > & | get_context_manager (void) |
std::size_t | get_max_worker_count (void) const |
worker_pool_type * | get_parent_pool (void) const |
Private Member Functions | |
core () | |
~core (void) | |
Private Attributes | |
friend | worker_pool |
worker_pool_type * | m_parent_pool |
std::size_t | m_max_workers |
worker * | m_worker_array |
worker ** | m_available_workers |
std::size_t | m_available_count |
std::queue< task_type * > | m_task_queue |
std::mutex | m_workers_mutex |
Definition at line 272 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::core::context_type = Context |
Definition at line 275 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::core::task_type = task<Context> |
Definition at line 276 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::core::worker_pool_type = worker_pool<Context> |
Definition at line 277 of file thread_worker_pool.hpp.
|
private |
Definition at line 837 of file thread_worker_pool.hpp.
|
private |
Definition at line 850 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_worker_array, and NULL.
void cubthread::worker_pool< Context >::core::become_available | ( | worker & | worker_arg | ) |
Definition at line 956 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_max_workers, and cubthread::worker_pool< Context >::core::m_workers_mutex.
void cubthread::worker_pool< Context >::core::check_worker_not_available | ( | const worker & | worker_arg | ) |
Definition at line 965 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, and cubthread::worker_pool< Context >::core::m_workers_mutex.
void cubthread::worker_pool< Context >::core::execute_task | ( | task_type * | task_p | ) |
Definition at line 899 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_parent_pool, cubthread::worker_pool< Context >::m_stopped, cubthread::worker_pool< Context >::core::m_task_queue, cubthread::worker_pool< Context >::core::m_workers_mutex, NULL, and cubthread::task< Context >::retire().
Referenced by cubthread::worker_pool< Context >::execute_on_core().
void cubthread::worker_pool< Context >::core::finished_task_notification | ( | void | ) |
Definition at line 891 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_parent_pool, and cubthread::worker_pool< Context >::m_task_count.
context_manager< typename worker_pool< Context >::core::context_type > & cubthread::worker_pool< Context >::core::get_context_manager | ( | void | ) |
Definition at line 979 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::m_context_manager, and cubthread::worker_pool< Context >::core::m_parent_pool.
std::size_t cubthread::worker_pool< Context >::core::get_max_worker_count | ( | void | ) | const |
Definition at line 986 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_max_workers.
Referenced by css_wp_core_job_scan_mapper().
|
inline |
Definition at line 317 of file thread_worker_pool.hpp.
void cubthread::worker_pool< Context >::core::get_stats | ( | cubperf::stat_value * | sum_inout | ) | const |
Definition at line 1106 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::get_stats(), cubthread::worker_pool< Context >::core::m_max_workers, and cubthread::worker_pool< Context >::core::m_worker_array.
Referenced by cubthread::worker_pool< Context >::get_stats().
worker_pool< Context >::core::task_type * cubthread::worker_pool< Context >::core::get_task_or_become_available | ( | worker & | worker_arg | ) |
Definition at line 937 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_max_workers, cubthread::worker_pool< Context >::core::m_task_queue, cubthread::worker_pool< Context >::core::m_workers_mutex, and NULL.
void cubthread::worker_pool< Context >::core::init_pool_and_workers | ( | worker_pool< Context > & | parent, |
std::size_t | worker_count | ||
) |
Definition at line 861 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::init_core(), cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_max_workers, cubthread::worker_pool< Context >::core::m_parent_pool, cubthread::worker_pool< Context >::m_pool_threads, cubthread::worker_pool< Context >::core::m_worker_array, and NULL.
Referenced by cubthread::worker_pool< Context >::worker_pool().
void cubthread::worker_pool< Context >::core::map_running_contexts | ( | bool & | stop, |
Func && | func, | ||
Args &&... | args | ||
) | const |
Definition at line 994 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_max_workers, cubthread::worker_pool< Context >::core::m_worker_array, and cubthread::worker_pool< Context >::core::worker::map_context_if_running().
Referenced by css_wp_core_job_scan_mapper(), and cubthread::worker_pool< Context >::map_running_contexts().
void cubthread::worker_pool< Context >::core::notify_stop | ( | bool & | is_not_stopped | ) |
Definition at line 1009 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_max_workers, cubthread::worker_pool< Context >::core::m_worker_array, and cubthread::worker_pool< Context >::core::worker::stop_execution().
Referenced by cubthread::worker_pool< Context >::stop_execution().
void cubthread::worker_pool< Context >::core::retire_queued_tasks | ( | void | ) |
Definition at line 1093 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::m_task_queue, and cubthread::worker_pool< Context >::core::m_workers_mutex.
Referenced by cubthread::worker_pool< Context >::stop_execution().
void cubthread::worker_pool< Context >::core::start_all_workers | ( | void | ) |
Definition at line 1020 of file thread_worker_pool.hpp.
References cubmem::appendable_array< T, S >::append(), cubmem::extensible_array< T, S >::get_array(), cubmem::appendable_array< T, S >::get_memsize(), cubmem::appendable_array< T, S >::get_size(), cubthread::worker_pool< Context >::core::worker::has_thread(), cubthread::worker_pool< Context >::core::m_available_count, cubthread::worker_pool< Context >::core::m_available_workers, cubthread::worker_pool< Context >::core::m_workers_mutex, NULL, cubthread::worker_pool< Context >::core::worker::set_has_thread(), cubthread::worker_pool< Context >::core::worker::set_push_time_now(), and cubthread::worker_pool< Context >::core::worker::start_thread().
Referenced by cubthread::worker_pool< Context >::start_all_workers().
|
private |
Definition at line 334 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::become_available(), cubthread::worker_pool< Context >::core::check_worker_not_available(), cubthread::worker_pool< Context >::core::execute_task(), cubthread::worker_pool< Context >::core::get_task_or_become_available(), cubthread::worker_pool< Context >::core::init_pool_and_workers(), and cubthread::worker_pool< Context >::core::start_all_workers().
|
private |
Definition at line 333 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::become_available(), cubthread::worker_pool< Context >::core::check_worker_not_available(), cubthread::worker_pool< Context >::core::execute_task(), cubthread::worker_pool< Context >::core::get_task_or_become_available(), cubthread::worker_pool< Context >::core::init_pool_and_workers(), cubthread::worker_pool< Context >::core::start_all_workers(), and cubthread::worker_pool< Context >::core::~core().
|
private |
Definition at line 331 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::become_available(), cubthread::worker_pool< Context >::core::get_max_worker_count(), cubthread::worker_pool< Context >::core::get_stats(), cubthread::worker_pool< Context >::core::get_task_or_become_available(), cubthread::worker_pool< Context >::core::init_pool_and_workers(), cubthread::worker_pool< Context >::core::map_running_contexts(), and cubthread::worker_pool< Context >::core::notify_stop().
|
private |
Definition at line 330 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::execute_task(), cubthread::worker_pool< Context >::core::finished_task_notification(), cubthread::worker_pool< Context >::core::get_context_manager(), and cubthread::worker_pool< Context >::core::init_pool_and_workers().
|
private |
|
private |
Definition at line 332 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::get_stats(), cubthread::worker_pool< Context >::core::init_pool_and_workers(), cubthread::worker_pool< Context >::core::map_running_contexts(), cubthread::worker_pool< Context >::core::notify_stop(), and cubthread::worker_pool< Context >::core::~core().
|
private |
Definition at line 336 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::become_available(), cubthread::worker_pool< Context >::core::check_worker_not_available(), cubthread::worker_pool< Context >::core::execute_task(), cubthread::worker_pool< Context >::core::get_task_or_become_available(), cubthread::worker_pool< Context >::core::retire_queued_tasks(), and cubthread::worker_pool< Context >::core::start_all_workers().
|
private |
Definition at line 324 of file thread_worker_pool.hpp.