COROIO: coroio/notifier.hpp Source File
COROIO
Loading...
Searching...
No Matches
notifier.hpp
1#pragma once
2
4
5#include <atomic>
6
7namespace NNet {
8
9#ifndef _WIN32
10
33class TNotifier {
34public:
36 explicit TNotifier(TPollerBase& poller);
37 ~TNotifier();
38
39 TNotifier(const TNotifier&) = delete;
40 TNotifier& operator=(const TNotifier&) = delete;
41
48 void Notify();
49
60
61private:
62 bool TryRead();
63
64 TPollerBase& Poller_;
65 int ReadFd_ = -1;
66 int WriteFd_ = -1;
67 std::atomic<bool> Pending_ = false;
68 bool Waiting_ = false;
69};
70
71#endif // _WIN32
72
73} // namespace NNet
TFuture< void > Wait()
Asynchronously waits for and consumes a notification.
Definition notifier.cpp:106
void Notify()
Signals the listener from any thread.
Definition notifier.cpp:58
TNotifier(TPollerBase &poller)
Creates a notifier bound to the listener's event-loop poller.
Definition notifier.cpp:17
Backend-independent base for I/O pollers.
Definition poller.hpp:39
Implementation of a promise/future system for coroutines.
Owned coroutine handle that carries a result of type T.
Definition corochain.hpp:185