CUBRID Engine
latest
|
#include <thread_worker_pool.hpp>
Public Types | |
using | core_type = typename worker_pool< Context >::core |
Public Member Functions | |
worker (void) | |
~worker (void) | |
void | init_core (core_type &parent) |
void | assign_task (task< Context > *work_p, cubperf::time_point push_time) |
void | start_thread (void) |
void | push_task_on_running_thread (task< Context > *work_p, cubperf::time_point push_time) |
void | stop_execution (bool &is_not_stopped) |
template<typename Func , typename... Args> | |
void | map_context_if_running (bool &stop, Func &&func, Args &&...args) |
void | get_stats (cubperf::stat_value *sum_inout) const |
std::mutex & | get_mutex (void) |
bool | has_thread (void) |
void | set_has_thread (void) |
void | set_push_time_now (void) |
Private Member Functions | |
void | run (void) |
void | init_run (void) |
void | finish_run (void) |
void | execute_current_task (void) |
void | retire_current_task (void) |
bool | get_new_task (void) |
Private Attributes | |
core_type * | m_parent_core |
Context * | m_context_p |
task_type * | m_task_p |
std::condition_variable | m_task_cv |
std::mutex | m_task_mutex |
bool | m_stop |
bool | m_has_thread |
cubperf::statset & | m_statistics |
cubperf::time_point | m_push_time |
Definition at line 405 of file thread_worker_pool.hpp.
using cubthread::worker_pool< Context >::core::worker::core_type = typename worker_pool<Context>::core |
Definition at line 408 of file thread_worker_pool.hpp.
cubthread::worker_pool< Context >::core::worker::worker | ( | void | ) |
Definition at line 1119 of file thread_worker_pool.hpp.
cubthread::worker_pool< Context >::core::worker::~worker | ( | void | ) |
Definition at line 1134 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::m_statistics, and cubthread::wp_worker_statset_destroy().
void cubthread::worker_pool< Context >::core::worker::assign_task | ( | task< Context > * | work_p, |
cubperf::time_point | push_time | ||
) |
Definition at line 1148 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_has_thread, cubthread::worker_pool< Context >::core::worker::m_push_time, cubthread::worker_pool< Context >::core::worker::m_task_cv, cubthread::worker_pool< Context >::core::worker::m_task_mutex, cubthread::worker_pool< Context >::core::worker::m_task_p, NULL, and cubthread::worker_pool< Context >::core::worker::start_thread().
Referenced by cubthread::worker_pool< Context >::core::execute_task(), and cubthread::worker_pool< Context >::core::init_pool_and_workers().
|
private |
Definition at line 1296 of file thread_worker_pool.hpp.
References assert, cubthread::task< Context >::execute(), cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_parent_core, cubthread::worker_pool< Context >::core::worker::m_statistics, cubthread::worker_pool< Context >::core::worker::m_task_p, NULL, cubthread::worker_pool< Context >::core::worker::retire_current_task(), and cubthread::wp_worker_statset_time_and_increment().
Referenced by cubthread::worker_pool< Context >::core::worker::run().
|
private |
Definition at line 1271 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_parent_core, cubthread::worker_pool< Context >::core::worker::m_statistics, cubthread::worker_pool< Context >::core::worker::m_task_p, NULL, and cubthread::wp_worker_statset_time_and_increment().
Referenced by cubthread::worker_pool< Context >::core::worker::get_new_task().
|
inline |
Definition at line 436 of file thread_worker_pool.hpp.
|
private |
Definition at line 1317 of file thread_worker_pool.hpp.
References assert, cubthread::condvar_wait(), cubthread::worker_pool< Context >::core::worker::finish_run(), cubthread::worker_pool< Context >::core::worker::m_has_thread, cubthread::worker_pool< Context >::core::worker::m_parent_core, cubthread::worker_pool< Context >::core::worker::m_push_time, cubthread::worker_pool< Context >::core::worker::m_statistics, cubthread::worker_pool< Context >::core::worker::m_stop, cubthread::worker_pool< Context >::core::worker::m_task_cv, cubthread::worker_pool< Context >::core::worker::m_task_mutex, cubthread::worker_pool< Context >::core::worker::m_task_p, cubperf::generic_statset< IsAtomic >::m_timept, NULL, and cubthread::wp_worker_statset_time_and_increment().
Referenced by cubthread::worker_pool< Context >::core::worker::run().
void cubthread::worker_pool< Context >::core::worker::get_stats | ( | cubperf::stat_value * | sum_inout | ) | const |
Definition at line 1427 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::m_statistics, and cubthread::wp_worker_statset_accumulate().
Referenced by cubthread::worker_pool< Context >::core::get_stats().
|
inline |
Definition at line 440 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::start_all_workers().
void cubthread::worker_pool< Context >::core::worker::init_core | ( | core_type & | parent | ) |
Definition at line 1141 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::m_parent_core.
Referenced by cubthread::worker_pool< Context >::core::init_pool_and_workers().
|
private |
Definition at line 1252 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_has_thread, cubthread::worker_pool< Context >::core::worker::m_parent_core, cubthread::worker_pool< Context >::core::worker::m_push_time, cubthread::worker_pool< Context >::core::worker::m_statistics, cubperf::generic_statset< IsAtomic >::m_timept, and cubthread::wp_worker_statset_time_and_increment().
Referenced by cubthread::worker_pool< Context >::core::worker::run().
void cubthread::worker_pool< Context >::core::worker::map_context_if_running | ( | bool & | stop, |
Func && | func, | ||
Args &&... | args | ||
) |
Definition at line 1435 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_task_p, and NULL.
Referenced by cubthread::worker_pool< Context >::core::map_running_contexts().
void cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread | ( | task< Context > * | work_p, |
cubperf::time_point | push_time | ||
) |
Definition at line 1200 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_push_time, cubthread::worker_pool< Context >::core::worker::m_task_cv, cubthread::worker_pool< Context >::core::worker::m_task_mutex, cubthread::worker_pool< Context >::core::worker::m_task_p, and NULL.
|
private |
Definition at line 1284 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_statistics, cubthread::worker_pool< Context >::core::worker::m_task_p, NULL, cubthread::task< Context >::retire(), and cubthread::wp_worker_statset_time_and_increment().
Referenced by cubthread::worker_pool< Context >::core::worker::execute_current_task().
|
private |
Definition at line 1393 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::execute_current_task(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::init_run(), cubthread::worker_pool< Context >::core::worker::m_task_p, and NULL.
Referenced by cubthread::worker_pool< Context >::core::worker::start_thread().
|
inline |
Definition at line 444 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::start_all_workers().
|
inline |
Definition at line 448 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::start_all_workers().
void cubthread::worker_pool< Context >::core::worker::start_thread | ( | void | ) |
Definition at line 1177 of file thread_worker_pool.hpp.
References assert, cubthread::worker_pool< Context >::core::worker::m_has_thread, cubthread::worker_pool< Context >::core::worker::run(), and cubthread::wp_call_func_throwing_system_error().
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), and cubthread::worker_pool< Context >::core::start_all_workers().
void cubthread::worker_pool< Context >::core::worker::stop_execution | ( | bool & | is_not_stopped | ) |
this thread is still running
Definition at line 1225 of file thread_worker_pool.hpp.
References cubthread::worker_pool< Context >::core::worker::m_context_p, cubthread::worker_pool< Context >::core::worker::m_has_thread, cubthread::worker_pool< Context >::core::worker::m_parent_core, cubthread::worker_pool< Context >::core::worker::m_stop, cubthread::worker_pool< Context >::core::worker::m_task_cv, cubthread::worker_pool< Context >::core::worker::m_task_mutex, and NULL.
Referenced by cubthread::worker_pool< Context >::core::notify_stop().
|
private |
Definition at line 469 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::execute_current_task(), cubthread::worker_pool< Context >::core::worker::finish_run(), cubthread::worker_pool< Context >::core::worker::init_run(), cubthread::worker_pool< Context >::core::worker::map_context_if_running(), cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 478 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::init_run(), cubthread::worker_pool< Context >::core::worker::start_thread(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 468 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::execute_current_task(), cubthread::worker_pool< Context >::core::worker::finish_run(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::init_core(), cubthread::worker_pool< Context >::core::worker::init_run(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 482 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::init_run(), and cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread().
|
private |
Definition at line 481 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::execute_current_task(), cubthread::worker_pool< Context >::core::worker::finish_run(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::get_stats(), cubthread::worker_pool< Context >::core::worker::init_run(), cubthread::worker_pool< Context >::core::worker::retire_current_task(), and cubthread::worker_pool< Context >::core::worker::~worker().
|
private |
Definition at line 477 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::get_new_task(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 474 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 476 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread(), and cubthread::worker_pool< Context >::core::worker::stop_execution().
|
private |
Definition at line 471 of file thread_worker_pool.hpp.
Referenced by cubthread::worker_pool< Context >::core::worker::assign_task(), cubthread::worker_pool< Context >::core::worker::execute_current_task(), cubthread::worker_pool< Context >::core::worker::finish_run(), cubthread::worker_pool< Context >::core::worker::get_new_task(), cubthread::worker_pool< Context >::core::worker::map_context_if_running(), cubthread::worker_pool< Context >::core::worker::push_task_on_running_thread(), cubthread::worker_pool< Context >::core::worker::retire_current_task(), and cubthread::worker_pool< Context >::core::worker::run().