![]() |
dfx 0.1.0
Linux-based dynamic dataflow executor
|
Interface to the host's event loop (Poller). More...
#include <dfx-plugins-interface/PluginInterface.h>
Public Attributes | |
| dfx_poller_handle_t | handle |
| Internal host context. Must be passed as the first argument to all functions. | |
| int(* | register_fd )(dfx_poller_handle_t handle, int fd, dfx_event_interest_t interests, dfx_fd_callback_t cb, void *user_data) |
| Registers a file descriptor with the host's poller. | |
| int(* | update_fd )(dfx_poller_handle_t handle, int fd, dfx_event_interest_t interests) |
| Updates the event interests for a previously registered file descriptor. | |
| void(* | deregister_fd )(dfx_poller_handle_t handle, int fd) |
| Deregisters a file descriptor from the host's poller. | |
| int(* | defer_call )(dfx_poller_handle_t handle, dfx_callback_t cb, void *user_data) |
| Defers a function call to the next iteration of the event loop. | |
Interface to the host's event loop (Poller).
This struct provides a bridge to the dfx::FdWatch::Poller. It allows plugins to register file descriptors (sockets, pipes, timers) to be monitored by the host's main event loop.
| int(* dfx_poller_api_t::defer_call) (dfx_poller_handle_t handle, dfx_callback_t cb, void *user_data) |
Defers a function call to the next iteration of the event loop.
This function allows the plugin to schedule a callback to be executed as soon as possible by the host's event loop thread, but not immediately. It is useful for:
| [in] | handle | The poller handle provided in this struct. |
| [in] | cb | The callback function to be invoked. |
| [in] | user_data | Opaque pointer passed back to cb. |
errno is set to:handle or cb is NULL.| void(* dfx_poller_api_t::deregister_fd) (dfx_poller_handle_t handle, int fd) |
Deregisters a file descriptor from the host's poller.
After this call, the host will no longer monitor the FD and the callback provided during registration will no longer be invoked.
| [in] | handle | The poller handle provided in this struct. |
| [in] | fd | The file descriptor to remove. |
| dfx_poller_handle_t dfx_poller_api_t::handle |
Internal host context. Must be passed as the first argument to all functions.
| int(* dfx_poller_api_t::register_fd) (dfx_poller_handle_t handle, int fd, dfx_event_interest_t interests, dfx_fd_callback_t cb, void *user_data) |
Registers a file descriptor with the host's poller.
Once registered, the host will monitor fd for the specified interests. When an event occurs, cb will be invoked from the host's event loop thread.
| [in] | handle | The poller handle provided in this struct. |
| [in] | fd | The file descriptor to monitor. The plugin remains the owner of this FD. |
| [in] | interests | Mask of DFX_EVENT_READ, DFX_EVENT_WRITE, etc. |
| [in] | cb | The callback function to trigger on events. |
| [in] | user_data | User-provided pointer passed back to the callback (typically the transport handle). |
errno is set to:handle or cb is NULL, or interests is invalid.fd is not a valid file descriptor.| int(* dfx_poller_api_t::update_fd) (dfx_poller_handle_t handle, int fd, dfx_event_interest_t interests) |
Updates the event interests for a previously registered file descriptor.
Use this to toggle between reading and writing, or to temporarily disable event triggers for an FD without deregistering it.
| [in] | handle | The poller handle provided in this struct. |
| [in] | fd | A previously registered file descriptor. |
| [in] | interests | The new mask of interests to apply. |
errno is set to:handle is NULL, or interests is invalid.fd is not a valid file descriptor.fd is not registered in this poller.