dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::FdWatch::Poller Class Referenceabstract

Abstract interface for FD-based event polling. More...

#include <dfx-fdwatch/Poller.hpp>

Inheritance diagram for dfx::FdWatch::Poller:
[legend]

Public Member Functions

virtual ~Poller ()=default
 Virtual destructor for interface.
virtual void registerFd (BorrowedFd fd, EventInterests events, FdCallback cb)=0
 Registers a file descriptor with the poller.
virtual void deregisterFd (BorrowedFd fd) noexcept=0
 Deregisters a file descriptor from the poller.
virtual void deferCall (Callback cb)=0
 Defer the call to the callback to the next time the event loop is reached.

Detailed Description

Abstract interface for FD-based event polling.

Poller is responsible for monitoring file descriptors and invoking user-provided callbacks when the requested events occur.

The interface does not own file descriptors: ownership remains with the caller (typically via OwnedFd or PollerFd).

Concrete implementations may be based on platform-specific mechanisms such as epoll, poll, or kqueue.

Thread-safety guarantees are implementation-defined; unless explicitly documented otherwise, all operations are expected to be performed from the same thread.

See also
EPollPoller

Constructor & Destructor Documentation

◆ ~Poller()

virtual dfx::FdWatch::Poller::~Poller ( )
virtualdefault

Virtual destructor for interface.

Member Function Documentation

◆ deferCall()

virtual void dfx::FdWatch::Poller::deferCall ( Callback cb)
pure virtual

Defer the call to the callback to the next time the event loop is reached.

The callback will be invoked as soon as all currently pending event in the event loop have been processed.

Parameters
cbCallback to be invoked later.

Implemented in dfx::FdWatch::EPollPoller, and dfx::Runtime::Api::PollerProxy.

◆ deregisterFd()

virtual void dfx::FdWatch::Poller::deregisterFd ( BorrowedFd fd)
pure virtualnoexcept

Deregisters a file descriptor from the poller.

After this call, the poller will no longer monitor the FD and no callbacks will be triggered for it.

Parameters
fdBorrowed file descriptor to remove.
Note
Deregistering an FD that is not registered is allowed

Implemented in dfx::FdWatch::EPollPoller, and dfx::Runtime::Api::PollerProxy.

◆ registerFd()

virtual void dfx::FdWatch::Poller::registerFd ( BorrowedFd fd,
EventInterests events,
FdCallback cb )
pure virtual

Registers a file descriptor with the poller.

Once registered, the poller will monitor fd for the specified events and invoke cb when they occur.

Parameters
fdBorrowed file descriptor to monitor.
eventsEvents of interest.
cbCallback invoked when events occur.
Precondition
fd must refer to a valid, open file descriptor.
Note
Registering the same FD more than once is a no-op. If you want to change the events monitored of the callback, then the FD must be deregistered first

Implemented in dfx::FdWatch::EPollPoller.


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