|
PACS System 0.1.0
PACS DICOM system library
|
Abstract interface for thread pool operations. More...
#include <thread_pool_interface.h>


Public Member Functions | |
| virtual | ~thread_pool_interface ()=default |
| Virtual destructor for proper polymorphic destruction. | |
| virtual auto | start () -> bool=0 |
| Start the thread pool. | |
| virtual auto | is_running () const noexcept -> bool=0 |
| Check if the thread pool is running. | |
| virtual void | shutdown (bool wait_for_completion=true)=0 |
| Shutdown the thread pool. | |
| virtual auto | submit (std::function< void()> task) -> std::future< void >=0 |
| Submit a task for execution. | |
| virtual auto | submit_with_priority (job_priority priority, std::function< void()> task) -> std::future< void >=0 |
| Submit a task with a specific priority level. | |
| virtual void | submit_fire_and_forget (std::function< void()> task)=0 |
| Submit a task without waiting for completion. | |
| virtual auto | get_thread_count () const -> std::size_t=0 |
| Get the current number of worker threads. | |
| virtual auto | get_pending_task_count () const -> std::size_t=0 |
| Get the number of pending tasks in the queue. | |
| virtual auto | get_idle_worker_count () const -> std::size_t=0 |
| Get the number of idle workers. | |
Protected Member Functions | |
| thread_pool_interface ()=default | |
| Protected default constructor for derived classes. | |
| thread_pool_interface (const thread_pool_interface &)=delete | |
| Non-copyable. | |
| thread_pool_interface & | operator= (const thread_pool_interface &)=delete |
| thread_pool_interface (thread_pool_interface &&)=default | |
| Movable. | |
| thread_pool_interface & | operator= (thread_pool_interface &&)=default |
Abstract interface for thread pool operations.
Provides a unified API for submitting tasks to a thread pool and managing its lifecycle. This interface enables dependency injection, allowing components to receive a thread pool instance rather than depending on global state.
Benefits:
Thread Safety:
Definition at line 112 of file thread_pool_interface.h.
|
virtualdefault |
Virtual destructor for proper polymorphic destruction.
|
protecteddefault |
Protected default constructor for derived classes.
|
protecteddelete |
Non-copyable.
|
protecteddefault |
Movable.
|
nodiscardpure virtual |
Get the number of idle workers.
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtual |
Get the number of pending tasks in the queue.
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtual |
Get the current number of worker threads.
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtualnoexcept |
Check if the thread pool is running.
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
protecteddelete |
|
protecteddefault |
|
pure virtual |
Shutdown the thread pool.
Stops accepting new tasks and optionally waits for pending tasks.
| wait_for_completion | If true, waits for all pending tasks to complete |
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtual |
Start the thread pool.
Initializes worker threads and begins accepting tasks. Safe to call multiple times; subsequent calls are no-ops if running.
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtual |
Submit a task for execution.
Submits a void-returning task to the thread pool for asynchronous execution with normal priority.
| task | The task to execute (must be callable with no arguments) |
| std::runtime_error | if pool is not running |
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
pure virtual |
Submit a task without waiting for completion.
Fire-and-forget submission for tasks where the result is not needed. Errors are logged but not propagated.
| task | The task to execute |
Implemented in kcenon::pacs::integration::thread_pool_adapter.
|
nodiscardpure virtual |
Submit a task with a specific priority level.
Jobs with higher priority (lower enum value) are processed first.
| priority | The priority level for this task |
| task | The task to execute |
| std::runtime_error | if pool is not running |
Implemented in kcenon::pacs::integration::thread_pool_adapter.