AsyncFw 1.2
Async Framework is c++ runtime with timers, poll notifiers, sockets, coroutines, etc.
 
Loading...
Searching...
No Matches
PollNotifier.h
1/*
2Copyright (c) 2026 Alexandr Kuzmuk
3
4This file is part of the AsyncFw project. Licensed under the MIT License.
5See {Link: LICENSE file https://mit-license.org} in the project root for full license information.
6*/
7
8#pragma once
9
10#include "../core/FunctionConnector.h"
11
12namespace AsyncFw {
15class PollNotifier {
16public:
17 PollNotifier();
19 PollNotifier(int, AbstractThread::PollEvents = AbstractThread::PollIn);
20 ~PollNotifier();
22 bool setDescriptor(int, AbstractThread::PollEvents = AbstractThread::PollIn);
24 bool setEvents(AbstractThread::PollEvents);
26 void removeDescriptor();
28 int descriptor() { return fd_; }
30 bool fail() { return fail_; }
31
33 FunctionConnectorProtected<PollNotifier>::Connector<AbstractThread::PollEvents> notify;
34
35private:
36 AbstractThread *thread_;
37 int fd_ = -1;
38 bool fail_ = false;
39};
40} // namespace AsyncFw
The AbstractThread class provides the base functionality for thread management.
Definition AbstractThread.h:46
bool setDescriptor(int, AbstractThread::PollEvents=AbstractThread::PollIn)
Assigns the file descriptor and watch events.
Definition PollNotifier.cpp:25
bool fail()
Returns true if error occurred.
Definition PollNotifier.h:30
bool setEvents(AbstractThread::PollEvents)
Set watch events.
Definition PollNotifier.cpp:38
int descriptor()
Returns the file descriptor.
Definition PollNotifier.h:28
void removeDescriptor()
Remove the file descriptor.
Definition PollNotifier.cpp:40
FunctionConnectorProtected< PollNotifier >::Connector< AbstractThread::PollEvents > notify
The PollNotifier::notify connector.
Definition PollNotifier.h:33