dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
CNodeExecutor.hpp
1// SPDX-FileCopyrightText: 2026 Vincent Leroy
2// SPDX-License-Identifier: MIT
3//
4// This file is part of dfx.
5//
6// Licensed under the MIT License. See the LICENSE file in the project root
7// for full license information.
8
9#pragma once
10
11// Standard includes
12#include <mutex>
13#include <vector>
14
15// Project includes
16#include "../../Plugin.hpp"
18#include <dfx-runtime-api/NodeTaskExecutor.hpp>
19#include <dfx-utilities/sync-queues/PriorityStableQueue.hpp>
20
21namespace dfx::Plugins
22{
38{
39 struct TaskContext
40 {
42 std::atomic_flag hasBeenPushed;
43 CNodeExecutor * self;
44 };
45
46public:
52
55
56public:
65 bool pushTask(Runtime::Api::TaskPtr task) override;
66
72 std::size_t pushTasks(std::span<Runtime::Api::TaskPtr> tasks) override;
73
74private:
75 std::unique_ptr<TaskContext> _createContext(Runtime::Api::TaskPtr task);
76 dfx_task_api_t _createTaskApi(TaskContext * ctx) noexcept;
77 void _onTaskFinished(TaskContext const & ctx) noexcept;
78
79private:
80 Plugin const & _plugin;
83
84private:
85 std::vector<std::unique_ptr<TaskContext>> _tasks;
86 std::mutex _mutex;
87};
88} // !namespace dfx::Plugins
C-ABI for the dfx framework plugin system.
void * dfx_task_executor_handle_t
Opaque handle representing a custom node executor created by the plugin.
Definition PluginInterface.h:90
bool pushTask(Runtime::Api::TaskPtr task) override
Forwards a single task to the plugin.
std::size_t pushTasks(std::span< Runtime::Api::TaskPtr > tasks) override
Forwards multiple tasks to the plugin.
~CNodeExecutor()
Destructor. Calls the plugin's destroy function.
CNodeExecutor(Plugin const &plugin, dfx_task_executor_interface_t interface)
Constructs a C-bridge for a task executor.
Manager for a loaded plugin shared library.
Definition Plugin.hpp:38
Interface for offloading task execution from the global pool to a specific node context.
Definition NodeTaskExecutor.hpp:41
Definition MessageApi.hpp:16
std::unique_ptr< Task > TaskPtr
Unique ownership pointer for tasks.
Definition Task.hpp:102
Host-provided API for interacting with a scheduled task.
Definition PluginInterface.h:308
Interface for a plugin-defined task executor.
Definition PluginInterface.h:345