dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
Poller.hpp
1// SPDX-FileCopyrightText: 2025 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// Project includes
12#include "BorrowedFd.hpp"
13#include "Callback.hpp"
14#include "Events.hpp"
15
16namespace dfx::FdWatch
17{
36class Poller
37{
38public:
40 virtual ~Poller() = default;
41
55 virtual void registerFd(BorrowedFd fd, EventInterests events, FdCallback cb) = 0;
56
65 virtual void deregisterFd(BorrowedFd fd) noexcept = 0;
66
73 virtual void deferCall(Callback cb) = 0;
74};
75} // !namespace dfx::FdWatch
Event interest and trigger flags for file-descriptor watching (Linux/epoll).
Non-owning wrapper around a file descriptor.
Definition BorrowedFd.hpp:37
Bitset wrapper for dfx::FdWatch::EventInterest values.
Abstract interface for FD-based event polling.
Definition Poller.hpp:37
virtual void registerFd(BorrowedFd fd, EventInterests events, FdCallback cb)=0
Registers a file descriptor with the poller.
virtual ~Poller()=default
Virtual destructor for interface.
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.
Definition SocketClient.hpp:23
std::function< void(BorrowedFd, EventTriggers)> FdCallback
Invoked when events occur on a watched file descriptor.
Definition Callback.hpp:28
std::move_only_function< void()> Callback
Generic move-only callback with no arguments.
Definition Callback.hpp:31