|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Typed thread pool with priority-based job routing using built-in job_types. More...
#include <iostream>#include <memory>#include <chrono>#include <thread>#include "logger/core/logger.h"#include <kcenon/thread/utils/formatter.h>#include <kcenon/thread/impl/typed_pool/typed_thread_pool.h>#include <format>
Go to the source code of this file.
Functions | |
| auto | initialize_logger () -> std::optional< std::string > |
| auto | create_default (const uint16_t &high_priority_workers, const uint16_t &normal_priority_workers, const uint16_t &low_priority_workers) -> std::tuple< std::shared_ptr< typed_thread_pool >, std::optional< std::string > > |
| auto | store_job (std::shared_ptr< typed_thread_pool > thread_pool) -> std::optional< std::string > |
| auto | main () -> int |
Variables | |
| bool | use_backup_ = false |
| uint32_t | max_lines_ = 0 |
| uint16_t | wait_interval_ = 100 |
| uint32_t | test_line_count_ = 1000000 |
| log_module::log_types | file_target_ = log_module::log_types::None |
| log_module::log_types | console_target_ = log_module::log_types::Information |
| log_module::log_types | callback_target_ = log_module::log_types::None |
| uint16_t | high_priority_workers_ = 3 |
| uint16_t | normal_priority_workers_ = 2 |
| uint16_t | low_priority_workers_ = 1 |
Typed thread pool with priority-based job routing using built-in job_types.
Definition in file typed_thread_pool_sample.cpp.
| auto create_default | ( | const uint16_t & | high_priority_workers, |
| const uint16_t & | normal_priority_workers, | ||
| const uint16_t & | low_priority_workers ) -> std::tuple<std::shared_ptr<typed_thread_pool>, std::optional<std::string>> |
Definition at line 64 of file typed_thread_pool_sample.cpp.
References kcenon::thread::utils::formatter::format().
Referenced by main().


| auto initialize_logger | ( | ) | -> std::optional<std::string> |
Definition at line 43 of file typed_thread_pool_sample.cpp.
References callback_target_, console_target_, file_target_, kcenon::thread::utils::formatter::format(), max_lines_, use_backup_, and wait_interval_.
Referenced by main().


| auto main | ( | ) | -> int |
Definition at line 143 of file typed_thread_pool_sample.cpp.
References create_default(), kcenon::thread::utils::formatter::format(), high_priority_workers_, initialize_logger(), low_priority_workers_, normal_priority_workers_, kcenon::thread::thread_pool::start(), kcenon::thread::thread_pool::stop(), store_job(), and kcenon::thread::thread_pool::to_string().

| auto store_job | ( | std::shared_ptr< typed_thread_pool > | thread_pool | ) | -> std::optional<std::string> |
Definition at line 112 of file typed_thread_pool_sample.cpp.
References kcenon::thread::thread_pool::enqueue_batch(), kcenon::thread::utils::formatter::format(), and test_line_count_.
Referenced by main().


| log_module::log_types callback_target_ = log_module::log_types::None |
Definition at line 37 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().
| log_module::log_types console_target_ = log_module::log_types::Information |
Definition at line 36 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().
| log_module::log_types file_target_ = log_module::log_types::None |
Definition at line 35 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().
| uint16_t high_priority_workers_ = 3 |
Definition at line 39 of file typed_thread_pool_sample.cpp.
Referenced by main().
| uint16_t low_priority_workers_ = 1 |
Definition at line 41 of file typed_thread_pool_sample.cpp.
Referenced by main().
| uint32_t max_lines_ = 0 |
Definition at line 32 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().
| uint16_t normal_priority_workers_ = 2 |
Definition at line 40 of file typed_thread_pool_sample.cpp.
Referenced by main().
| uint32_t test_line_count_ = 1000000 |
Definition at line 34 of file typed_thread_pool_sample.cpp.
Referenced by store_job().
| bool use_backup_ = false |
Definition at line 31 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().
| uint16_t wait_interval_ = 100 |
Definition at line 33 of file typed_thread_pool_sample.cpp.
Referenced by initialize_logger().