![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
A priority-aware implementation of the NodeTaskExecutor interface. More...
#include <dfx-core/CustomExecutor.hpp>
Public Member Functions | |
| bool | pushTask (Runtime::Api::TaskPtr task) override |
| Pushes a task into the priority-stable execution queue. | |
| std::size_t | pushTasks (std::span< Runtime::Api::TaskPtr > tasks) override |
| Pushes a batch of tasks into the execution queue. | |
| void | processNextTask () |
| Consumes and executes the single highest-priority task currently in the queue. | |
| void | processAllPendingTasks () |
| Drains the entire queue, executing all pending tasks in priority order. | |
| Public Member Functions inherited from dfx::Runtime::Api::NodeTaskExecutor | |
| virtual | ~NodeTaskExecutor ()=default |
| Virtual destructor. | |
A priority-aware implementation of the NodeTaskExecutor interface.
CustomExecutor provides a mechanism to redirect node task execution into a private, priority-stable queue. This is particularly useful for nodes that require specific execution ordering or need to manage task processing on a specific thread (e.g., a UI thread or a dedicated IO thread).
The "Consumer" side of the queue is manually triggered via processNextTask or processAllPendingTasks.
The internal queue is unbounded meaning that an "infinite" number of task can be pushed to it which can lead to an OOM if task arn't consumed.
| void dfx::Core::CustomExecutor::processAllPendingTasks | ( | ) |
Drains the entire queue, executing all pending tasks in priority order.
This method continues processing until the queue is empty.
| void dfx::Core::CustomExecutor::processNextTask | ( | ) |
Consumes and executes the single highest-priority task currently in the queue.
This method should be called by the thread "owning" the execution context (e.g., inside a loop or a timer callback). If the queue is empty, this operation does nothing.
|
overridevirtual |
Pushes a task into the priority-stable execution queue.
| task | The task to be executed. |
Implements dfx::Runtime::Api::NodeTaskExecutor.
|
overridevirtual |
Pushes a batch of tasks into the execution queue.
Optimizes enqueueing by minimizing locking overhead for multiple tasks.
| tasks | A span of task pointers to be enqueued. |
Implements dfx::Runtime::Api::NodeTaskExecutor.