|
Network System 0.1.1
High-performance modular networking library for scalable client-server applications
|
Basic thread pool implementation for standalone use. More...
#include <thread_integration.h>


Classes | |
| class | impl |
Public Member Functions | |
| basic_thread_pool (size_t num_threads=0) | |
| Construct with specified number of threads. | |
| ~basic_thread_pool () | |
| std::future< void > | submit (std::function< void()> task) override |
| Submit a task to the thread pool. | |
| std::future< void > | submit_delayed (std::function< void()> task, std::chrono::milliseconds delay) override |
| Submit a task with delay. | |
| size_t | worker_count () const override |
| Get the number of worker threads. | |
| bool | is_running () const override |
| Check if the thread pool is running. | |
| size_t | pending_tasks () const override |
| Get pending task count. | |
| void | stop (bool wait_for_tasks=true) |
| Stop the thread pool. | |
| size_t | completed_tasks () const |
| Get completed tasks count. | |
Public Member Functions inherited from kcenon::network::integration::thread_pool_interface | |
| virtual | ~thread_pool_interface ()=default |
| virtual | ~thread_pool_interface ()=default |
Private Attributes | |
| std::shared_ptr< impl > | pimpl_ |
| PIMPL pointer with intentional leak pattern. | |
Basic thread pool implementation for standalone use.
This provides a simple thread pool implementation for when thread_system is not available.
Definition at line 81 of file thread_integration.h.
|
explicit |
Construct with specified number of threads.
| num_threads | Number of worker threads (0 = hardware concurrency) |
Definition at line 406 of file thread_integration.cpp.
|
default |
| size_t kcenon::network::integration::basic_thread_pool::completed_tasks | ( | ) | const |
Get completed tasks count.
Definition at line 443 of file thread_integration.cpp.
References pimpl_.
|
overridevirtual |
Check if the thread pool is running.
Implements kcenon::network::integration::thread_pool_interface.
Definition at line 431 of file thread_integration.cpp.
References pimpl_.
|
overridevirtual |
Get pending task count.
Implements kcenon::network::integration::thread_pool_interface.
Definition at line 435 of file thread_integration.cpp.
References pimpl_.
| void kcenon::network::integration::basic_thread_pool::stop | ( | bool | wait_for_tasks = true | ) |
Stop the thread pool.
| wait_for_tasks | Whether to wait for pending tasks |
Definition at line 439 of file thread_integration.cpp.
References pimpl_.
|
overridevirtual |
Submit a task to the thread pool.
| task | The task to execute |
Implements kcenon::network::integration::thread_pool_interface.
Definition at line 416 of file thread_integration.cpp.
References pimpl_.
|
overridevirtual |
Submit a task with delay.
| task | The task to execute |
| delay | Delay before execution |
Implements kcenon::network::integration::thread_pool_interface.
Definition at line 420 of file thread_integration.cpp.
References pimpl_.
|
overridevirtual |
Get the number of worker threads.
Implements kcenon::network::integration::thread_pool_interface.
Definition at line 427 of file thread_integration.cpp.
References pimpl_.
|
private |
PIMPL pointer with intentional leak pattern.
Uses shared_ptr with no-op deleter to prevent heap corruption during static destruction. This is intentional - see docs/DESIGN_DECISIONS.md for detailed rationale.
Definition at line 133 of file thread_integration.h.
Referenced by completed_tasks(), is_running(), pending_tasks(), stop(), submit(), submit_delayed(), and worker_count().