|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Abstract interface for queue adapters used by thread_pool. More...
#include <pool_queue_adapter.h>


Public Member Functions | |
| virtual | ~pool_queue_adapter_interface ()=default |
| virtual auto | enqueue (std::unique_ptr< job > &&job) -> common::VoidResult=0 |
| Enqueue a job. | |
| virtual auto | enqueue_batch (std::vector< std::unique_ptr< job > > &&jobs) -> common::VoidResult=0 |
| Enqueue a batch of jobs. | |
| virtual auto | dequeue () -> common::Result< std::unique_ptr< job > >=0 |
| Dequeue a job (blocking) | |
| virtual auto | try_dequeue () -> common::Result< std::unique_ptr< job > >=0 |
| Try to dequeue a job (non-blocking) | |
| virtual auto | empty () const -> bool=0 |
| Check if queue is empty. | |
| virtual auto | size () const -> std::size_t=0 |
| Get queue size. | |
| virtual auto | clear () -> void=0 |
| Clear all jobs from queue. | |
| virtual auto | stop () -> void=0 |
| Stop the queue. | |
| virtual auto | is_stopped () const -> bool=0 |
| Check if queue is stopped. | |
| virtual auto | get_capabilities () const -> queue_capabilities=0 |
| Get queue capabilities. | |
| virtual auto | to_string () const -> std::string=0 |
| Get string representation. | |
| virtual auto | get_job_queue () const -> std::shared_ptr< job_queue >=0 |
| Get the underlying job_queue if this adapter wraps one. | |
| virtual auto | get_scheduler () -> scheduler_interface &=0 |
| Get the underlying scheduler interface. | |
| virtual auto | get_scheduler () const -> const scheduler_interface &=0 |
| Get the underlying scheduler interface (const) | |
Abstract interface for queue adapters used by thread_pool.
This interface provides a unified API for both job_queue and policy_queue, allowing thread_pool to work with either queue type seamlessly.
Uses the Adapter pattern to provide a common interface for different queue implementations. This enables thread_pool to be decoupled from specific queue implementations while maintaining type safety.
All methods delegate to the underlying queue implementation, which must provide its own thread safety guarantees.
Definition at line 48 of file pool_queue_adapter.h.
|
virtualdefault |
|
pure virtual |
Clear all jobs from queue.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Dequeue a job (blocking)
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Check if queue is empty.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Enqueue a job.
| job | Job to enqueue |
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Enqueue a batch of jobs.
| jobs | Jobs to enqueue |
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get queue capabilities.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get the underlying job_queue if this adapter wraps one.
This method is provided for backward compatibility with code that needs direct access to job_queue. Returns nullptr for policy_queue adapters.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get the underlying scheduler interface.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get the underlying scheduler interface (const)
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Check if queue is stopped.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get queue size.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
pure virtual |
Stop the queue.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Get string representation.
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.
|
nodiscardpure virtual |
Try to dequeue a job (non-blocking)
Implemented in kcenon::thread::job_queue_adapter, and kcenon::thread::policy_queue_adapter< SyncPolicy, BoundPolicy, OverflowPolicy >.