CUBRID Engine  latest
cubthread::manager Class Reference

#include <thread_manager.hpp>

Collaboration diagram for cubthread::manager:
Collaboration graph

Public Member Functions

 manager ()
 
 ~manager ()
 
void alloc_entries (void)
 
void init_entries (bool with_lock_free=false)
 
void init_lockfree_system ()
 
entry_workpoolcreate_worker_pool (std::size_t pool_size, std::size_t task_max_count, const char *name, entry_manager *context_manager, std::size_t core_count, bool debug_logging, bool pool_threads=false, wait_seconds wait_for_task_time=std::chrono::seconds(5))
 
void destroy_worker_pool (entry_workpool *&worker_pool_arg)
 
void push_task (entry_workpool *worker_pool_arg, entry_task *exec_p)
 
void push_task_on_core (entry_workpool *worker_pool_arg, entry_task *exec_p, std::size_t core_hash)
 
bool try_task (entry &thread_p, entry_workpool *worker_pool_arg, entry_task *exec_p)
 
bool is_pool_full (entry_workpool *worker_pool_arg)
 
daemoncreate_daemon (const looper &looper_arg, entry_task *exec_p, const char *daemon_name="", entry_manager *context_manager=NULL)
 
void destroy_daemon (daemon *&daemon_arg)
 
daemoncreate_daemon_without_entry (const looper &looper_arg, task_without_context *exec_p, const char *daemon_name)
 
void destroy_daemon_without_entry (daemon *&daemon_arg)
 
std::size_t get_max_thread_count (void) const
 
void check_all_killed (void)
 
entryget_all_entries (void)
 
lockfree::tran::systemget_lockfree_transys ()
 
void set_max_thread_count_from_config ()
 
void set_max_thread_count (std::size_t count)
 
void return_lock_free_transaction_entries (void)
 
entryfind_by_tid (thread_id_t tid)
 
template<typename Func , typename... Args>
void map_entries (Func &&func, Args &&...args)
 

Private Types

using entry_dispatcher = resource_shared_pool< entry >
 

Private Member Functions

entryclaim_entry (void)
 
void retire_entry (entry &entry_p)
 
template<typename Res , typename... CtArgs>
Res * create_and_track_resource (std::vector< Res * > &tracker, size_t entries_count, CtArgs &&...args)
 
template<typename Res >
void destroy_and_untrack_resource (std::vector< Res * > &tracker, Res *&res, std::size_t entries_count)
 
template<typename Res >
void destroy_and_untrack_all_resources (std::vector< Res * > &tracker)
 

Private Attributes

std::size_t m_max_threads
 
std::mutex m_entries_mutex
 
std::vector< entry_workpool * > m_worker_pools
 
std::vector< daemon * > m_daemons
 
std::vector< daemon * > m_daemons_without_entries
 
entrym_all_entries
 
entry_dispatcherm_entry_dispatcher
 
std::size_t m_available_entries_count
 
entry_managerm_entry_manager
 
daemon_entry_managerm_daemon_entry_manager
 
lockfree::tran::systemm_lf_tran_sys
 

Friends

class entry_manager
 
void initialize (entry *&my_entry)
 
void finalize (void)
 

Detailed Description

Definition at line 108 of file thread_manager.hpp.

Member Typedef Documentation

Constructor & Destructor Documentation

cubthread::manager::manager ( void  )

Definition at line 3247 of file error_manager.c.

References assert_release, er_init(), and NO_ERROR.

Referenced by cubthread::initialize(), and cubthread::set_manager().

Here is the caller graph for this function:

cubthread::manager::~manager ( void  )

Definition at line 3255 of file error_manager.c.

References ER_ALL_FINAL, and er_final().

Member Function Documentation

void cubthread::manager::alloc_entries ( void  )

Definition at line 81 of file thread_manager.cpp.

References assert, m_all_entries, m_available_entries_count, m_entry_dispatcher, and m_max_threads.

Referenced by cubthread::initialize_thread_entries().

Here is the caller graph for this function:

void cubthread::manager::check_all_killed ( void  )
entry * cubthread::manager::claim_entry ( void  )
private

Definition at line 381 of file thread_manager.cpp.

References resource_shared_pool< T >::claim(), m_entry_dispatcher, and cubthread::tl_Entry_p.

Referenced by cubthread::entry_manager::create_context().

Here is the caller graph for this function:

template<typename Res , typename... CtArgs>
Res * cubthread::manager::create_and_track_resource ( std::vector< Res * > &  tracker,
size_t  entries_count,
CtArgs &&...  args 
)
inlineprivate

Definition at line 138 of file thread_manager.cpp.

References cubthread::check_not_single_thread(), m_available_entries_count, m_entries_mutex, and NULL.

Referenced by create_daemon(), create_daemon_without_entry(), and create_worker_pool().

Here is the caller graph for this function:

daemon * cubthread::manager::create_daemon ( const looper looper_arg,
entry_task exec_p,
const char *  daemon_name = "",
entry_manager context_manager = NULL 
)
daemon * cubthread::manager::create_daemon_without_entry ( const looper looper_arg,
task_without_context exec_p,
const char *  daemon_name 
)
entry_workpool * cubthread::manager::create_worker_pool ( std::size_t  pool_size,
std::size_t  task_max_count,
const char *  name,
entry_manager context_manager,
std::size_t  core_count,
bool  debug_logging,
bool  pool_threads = false,
wait_seconds  wait_for_task_time = std::chrono::seconds (5) 
)
template<typename Res >
void cubthread::manager::destroy_and_untrack_all_resources ( std::vector< Res * > &  tracker)
private

Definition at line 122 of file thread_manager.cpp.

References assert.

Referenced by check_all_killed().

Here is the caller graph for this function:

template<typename Res >
void cubthread::manager::destroy_and_untrack_resource ( std::vector< Res * > &  tracker,
Res *&  res,
std::size_t  entries_count 
)
inlineprivate

Definition at line 229 of file thread_manager.cpp.

References assert, cubthread::check_not_single_thread(), m_available_entries_count, m_entries_mutex, and NULL.

Referenced by destroy_daemon(), destroy_daemon_without_entry(), and destroy_worker_pool().

Here is the caller graph for this function:

void cubthread::manager::destroy_daemon ( daemon *&  daemon_arg)
void cubthread::manager::destroy_daemon_without_entry ( daemon *&  daemon_arg)
void cubthread::manager::destroy_worker_pool ( entry_workpool *&  worker_pool_arg)
entry * cubthread::manager::find_by_tid ( thread_id_t  tid)

Definition at line 446 of file thread_manager.cpp.

References cubthread::Is_single_thread, m_all_entries, m_max_threads, and NULL.

Referenced by csect_start_scan(), and tz_get_client_tz_region_session().

Here is the caller graph for this function:

entry* cubthread::manager::get_all_entries ( void  )
inline

Definition at line 198 of file thread_manager.hpp.

lockfree::tran::system& cubthread::manager::get_lockfree_transys ( )
inline

Definition at line 203 of file thread_manager.hpp.

References cubregex::count(), and cubthread::return_lock_free_transaction_entries().

Referenced by cubthread::get_thread_entry_lftransys(), and cubthread::initialize_thread_entries().

Here is the caller graph for this function:

std::size_t cubthread::manager::get_max_thread_count ( void  ) const

Definition at line 398 of file thread_manager.cpp.

References m_max_threads.

Referenced by cubthread::get_max_thread_count(), and cubthread::initialize_thread_entries().

Here is the caller graph for this function:

void cubthread::manager::init_entries ( bool  with_lock_free = false)
void cubthread::manager::init_lockfree_system ( )

Definition at line 111 of file thread_manager.cpp.

References m_lf_tran_sys, and m_max_threads.

Referenced by cubthread::initialize_thread_entries().

Here is the caller graph for this function:

bool cubthread::manager::is_pool_full ( entry_workpool worker_pool_arg)

Definition at line 340 of file thread_manager.cpp.

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

template<typename Func , typename... Args>
void cubthread::manager::map_entries ( Func &&  func,
Args &&...  args 
)
void cubthread::manager::push_task_on_core ( entry_workpool worker_pool_arg,
entry_task exec_p,
std::size_t  core_hash 
)
void cubthread::manager::retire_entry ( entry entry_p)
private

Definition at line 389 of file thread_manager.cpp.

References assert, m_entry_dispatcher, NULL, and resource_shared_pool< T >::retire().

Referenced by cubthread::entry_manager::retire_context().

Here is the caller graph for this function:

void cubthread::manager::return_lock_free_transaction_entries ( void  )
void cubthread::manager::set_max_thread_count ( std::size_t  count)

Definition at line 430 of file thread_manager.cpp.

References cubregex::count(), and m_max_threads.

void cubthread::manager::set_max_thread_count_from_config ( void  )

Definition at line 413 of file thread_manager.cpp.

References m_max_threads, NUM_NON_SYSTEM_TRANS, prm_get_integer_value(), and PRM_ID_VACUUM_WORKER_COUNT.

Referenced by cubthread::initialize_thread_entries().

Here is the caller graph for this function:

Friends And Related Function Documentation

friend class entry_manager
friend

Definition at line 225 of file thread_manager.hpp.

void finalize ( void  )
friend

Definition at line 54 of file internal_tasks_worker_pool.cpp.

void initialize ( entry *&  my_entry)
friend

Definition at line 472 of file thread_manager.cpp.

Member Data Documentation

entry* cubthread::manager::m_all_entries
private
std::size_t cubthread::manager::m_available_entries_count
private
daemon_entry_manager* cubthread::manager::m_daemon_entry_manager
private

Definition at line 265 of file thread_manager.hpp.

Referenced by create_daemon().

std::vector<daemon *> cubthread::manager::m_daemons
private

Definition at line 254 of file thread_manager.hpp.

Referenced by check_all_killed(), create_daemon(), and destroy_daemon().

std::vector<daemon *> cubthread::manager::m_daemons_without_entries
private
std::mutex cubthread::manager::m_entries_mutex
private

Definition at line 250 of file thread_manager.hpp.

Referenced by create_and_track_resource(), and destroy_and_untrack_resource().

entry_dispatcher* cubthread::manager::m_entry_dispatcher
private

Definition at line 261 of file thread_manager.hpp.

Referenced by alloc_entries(), claim_entry(), and retire_entry().

entry_manager* cubthread::manager::m_entry_manager
private

Definition at line 264 of file thread_manager.hpp.

Referenced by create_worker_pool().

lockfree::tran::system* cubthread::manager::m_lf_tran_sys
private
std::vector<entry_workpool *> cubthread::manager::m_worker_pools
private

Definition at line 252 of file thread_manager.hpp.

Referenced by check_all_killed(), create_worker_pool(), and destroy_worker_pool().


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