|
Common System 0.2.0
Common interfaces and patterns for system integration
|
Extended interface for thread pool implementations. More...
#include <thread_pool_interface.h>


Public Member Functions | |
| virtual | ~IThreadPool ()=default |
| virtual VoidResult | resize (size_t new_size)=0 |
| Resize the thread pool. | |
| virtual size_t | min_workers () const |
| Get the minimum number of worker threads. | |
| virtual size_t | max_workers () const |
| Get the maximum number of worker threads. | |
| virtual VoidResult | set_queue_capacity (size_t capacity)=0 |
| Set the maximum queue capacity. | |
| virtual size_t | get_queue_capacity () const =0 |
| Get the current queue capacity. | |
| virtual bool | is_queue_full () const =0 |
| Check if the queue is full. | |
| virtual size_t | clear_pending_tasks ()=0 |
| Clear all pending tasks. | |
| virtual VoidResult | start ()=0 |
| Start the thread pool. | |
| virtual VoidResult | stop (bool wait_for_completion=true)=0 |
| Stop the thread pool. | |
| virtual VoidResult | pause ()=0 |
| Pause task processing. | |
| virtual VoidResult | resume ()=0 |
| Resume task processing. | |
| virtual bool | is_paused () const =0 |
| Check if the pool is paused. | |
| virtual size_t | active_tasks () const =0 |
| Get the number of active (executing) tasks. | |
| virtual size_t | idle_workers () const =0 |
| Get the number of idle workers. | |
| virtual size_t | completed_tasks () const |
| Get total number of completed tasks. | |
| virtual size_t | failed_tasks () const |
| Get total number of failed tasks. | |
| virtual | ~IThreadPool ()=default |
| virtual VoidResult | resize (size_t new_size)=0 |
| virtual size_t | min_workers () const |
| virtual size_t | max_workers () const |
| virtual VoidResult | set_queue_capacity (size_t capacity)=0 |
| virtual size_t | get_queue_capacity () const =0 |
| virtual bool | is_queue_full () const =0 |
| virtual size_t | clear_pending_tasks ()=0 |
| virtual VoidResult | start ()=0 |
| virtual VoidResult | stop (bool wait_for_completion=true)=0 |
| virtual VoidResult | pause ()=0 |
| virtual VoidResult | resume ()=0 |
| virtual bool | is_paused () const =0 |
| virtual size_t | active_tasks () const =0 |
| virtual size_t | idle_workers () const =0 |
| virtual size_t | completed_tasks () const |
| virtual size_t | failed_tasks () const |
Public Member Functions inherited from kcenon::common::interfaces::IExecutor | |
| virtual | ~IExecutor ()=default |
| virtual Result< std::future< void > > | execute (std::unique_ptr< IJob > &&job)=0 |
| Execute a job with Result-based error handling. | |
| virtual Result< std::future< void > > | execute_delayed (std::unique_ptr< IJob > &&job, std::chrono::milliseconds delay)=0 |
| Execute a job with delay. | |
| virtual size_t | worker_count () const =0 |
| Get the number of worker threads. | |
| virtual bool | is_running () const =0 |
| Check if the executor is running. | |
| virtual size_t | pending_tasks () const =0 |
| Get the number of pending tasks. | |
| virtual void | shutdown (bool wait_for_completion=true)=0 |
| Shutdown the executor gracefully. | |
| virtual | ~IExecutor ()=default |
| virtual Result< std::future< void > > | execute (std::unique_ptr< IJob > &&job)=0 |
| Execute a job with Result-based error handling. | |
| virtual Result< std::future< void > > | execute_delayed (std::unique_ptr< IJob > &&job, std::chrono::milliseconds delay)=0 |
| Execute a job with delay. | |
| virtual size_t | worker_count () const =0 |
| Get the number of worker threads. | |
| virtual bool | is_running () const =0 |
| Check if the executor is running. | |
| virtual size_t | pending_tasks () const =0 |
| Get the number of pending tasks. | |
| virtual void | shutdown (bool wait_for_completion=true)=0 |
| Shutdown the executor gracefully. | |
Extended interface for thread pool implementations.
This interface extends IExecutor with thread pool-specific functionality such as dynamic resizing, queue capacity management, and fine-grained lifecycle control.
Definition at line 138 of file executor.cppm.
|
virtualdefault |
|
exportvirtualdefault |
|
pure virtual |
Get the number of active (executing) tasks.
|
exportpure virtual |
|
pure virtual |
Clear all pending tasks.
This operation removes all pending tasks from the queue. Currently executing tasks are not affected.
|
exportpure virtual |
|
inlinevirtual |
Get total number of completed tasks.
Definition at line 151 of file thread_pool_interface.h.
|
inlineexportvirtual |
Definition at line 156 of file executor.cppm.
|
inlinevirtual |
Get total number of failed tasks.
Definition at line 157 of file thread_pool_interface.h.
|
inlineexportvirtual |
Definition at line 157 of file executor.cppm.
|
pure virtual |
Get the current queue capacity.
|
exportpure virtual |
|
pure virtual |
Get the number of idle workers.
|
exportpure virtual |
|
pure virtual |
Check if the pool is paused.
|
exportpure virtual |
|
pure virtual |
Check if the queue is full.
|
exportpure virtual |
|
inlinevirtual |
Get the maximum number of worker threads.
Definition at line 59 of file thread_pool_interface.h.
|
inlineexportvirtual |
Definition at line 144 of file executor.cppm.
|
inlinevirtual |
Get the minimum number of worker threads.
Definition at line 53 of file thread_pool_interface.h.
|
inlineexportvirtual |
Definition at line 143 of file executor.cppm.
|
pure virtual |
Pause task processing.
When paused:
|
exportpure virtual |
|
pure virtual |
Resize the thread pool.
| new_size | New number of worker threads |
Resizing may fail if:
|
exportpure virtual |
|
pure virtual |
Resume task processing.
|
exportpure virtual |
|
pure virtual |
Set the maximum queue capacity.
| capacity | Maximum number of pending tasks (0 = unlimited) |
|
exportpure virtual |
|
pure virtual |
Start the thread pool.
Starting an already running pool is a no-op.
|
exportpure virtual |
|
pure virtual |
Stop the thread pool.
| wait_for_completion | Wait for all pending tasks |
This is an alias for shutdown() for consistency.
|
exportpure virtual |