dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx_task_executor_interface_t Struct Reference

Interface for a plugin-defined task executor. More...

#include <dfx-plugins-interface/PluginInterface.h>

Public Attributes

dfx_task_executor_handle_t(* build )(void)
 Instantiates the plugin's internal executor state.
void(* destroy )(dfx_task_executor_handle_t handle)
 Destroys the executor instance and frees associated memory.
int(* push_task )(dfx_task_executor_handle_t handle, dfx_task_api_t const *task_api, size_t task_api_size)
 Enqueues a task for execution within the plugin's context.

Detailed Description

Interface for a plugin-defined task executor.

This vtable allows a node to "hijack" its own task execution. Instead of the host running tasks on the global thread pool, it will forward them to this interface.

See also
dfx::Runtime::Api::NodeTaskExecutor

Member Data Documentation

◆ build

dfx_task_executor_handle_t(* dfx_task_executor_interface_t::build) (void)

Instantiates the plugin's internal executor state.

Returns
An opaque handle to the plugin's executor instance.

◆ destroy

void(* dfx_task_executor_interface_t::destroy) (dfx_task_executor_handle_t handle)

Destroys the executor instance and frees associated memory.

Parameters
[in]handleThe executor handle returned by build.

◆ push_task

int(* dfx_task_executor_interface_t::push_task) (dfx_task_executor_handle_t handle, dfx_task_api_t const *task_api, size_t task_api_size)

Enqueues a task for execution within the plugin's context.

This is called by the host's NodeReactor when an event triggers. The plugin is expected to store the task and call dfx_task_api_t::run on its own thread(s).

If the plugin tries to run the task immediately on the calling thread then the task will not be run and an error will be returned by dfx_task_api_t::run.

Parameters
[in]handleThe executor handle returned by build.
[in]task_apiAPI to interact with and run the task.
[in]task_api_sizeSize of the dfx_task_api_t.
Returns
DFX_OK if the task was accepted, DFX_ERROR otherwise.
Note
This function must be non-blocking and thread-safe.

The documentation for this struct was generated from the following file: