|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Typed thread pool with a custom priority enum (test_priority) More...
#include <iostream>#include <memory>#include <chrono>#include <thread>#include "logger/core/logger.h"#include <kcenon/thread/utils/formatter.h>#include "test_type.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 &top_priority_workers, const uint16_t &middle_priority_workers, const uint16_t &bottom_priority_workers) -> std::tuple< std::shared_ptr< typed_thread_pool_t< test_priority > >, std::optional< std::string > > |
| auto | store_job (std::shared_ptr< typed_thread_pool_t< test_priority > > 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 | top_priority_workers_ = 3 |
| uint16_t | middle_priority_workers_ = 2 |
| uint16_t | bottom_priority_workers_ = 1 |
Typed thread pool with a custom priority enum (test_priority)
Definition in file typed_thread_pool_sample_2.cpp.
| auto create_default | ( | const uint16_t & | top_priority_workers, |
| const uint16_t & | middle_priority_workers, | ||
| const uint16_t & | bottom_priority_workers ) -> std::tuple<std::shared_ptr<typed_thread_pool_t<test_priority>>, std::optional<std::string>> |
Definition at line 65 of file typed_thread_pool_sample_2.cpp.
References Bottom, kcenon::thread::utils::formatter::format(), Middle, and Top.
Referenced by main().


| auto initialize_logger | ( | ) | -> std::optional<std::string> |
Definition at line 44 of file typed_thread_pool_sample_2.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 145 of file typed_thread_pool_sample_2.cpp.
References bottom_priority_workers_, create_default(), kcenon::thread::utils::formatter::format(), initialize_logger(), middle_priority_workers_, kcenon::thread::thread_pool::start(), kcenon::thread::thread_pool::stop(), store_job(), kcenon::thread::thread_pool::to_string(), and top_priority_workers_.

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


| uint16_t bottom_priority_workers_ = 1 |
Definition at line 42 of file typed_thread_pool_sample_2.cpp.
Referenced by main().
| log_module::log_types callback_target_ = log_module::log_types::None |
Definition at line 38 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().
| log_module::log_types console_target_ = log_module::log_types::Information |
Definition at line 37 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().
| log_module::log_types file_target_ = log_module::log_types::None |
Definition at line 36 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().
| uint32_t max_lines_ = 0 |
Definition at line 33 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().
| uint16_t middle_priority_workers_ = 2 |
Definition at line 41 of file typed_thread_pool_sample_2.cpp.
Referenced by main().
| uint32_t test_line_count_ = 1000000 |
Definition at line 35 of file typed_thread_pool_sample_2.cpp.
Referenced by store_job().
| uint16_t top_priority_workers_ = 3 |
Definition at line 40 of file typed_thread_pool_sample_2.cpp.
Referenced by main().
| bool use_backup_ = false |
Definition at line 32 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().
| uint16_t wait_interval_ = 100 |
Definition at line 34 of file typed_thread_pool_sample_2.cpp.
Referenced by initialize_logger().