COROIO: coroio/backends/epoll.hpp Source File
COROIO
Loading...
Searching...
No Matches
epoll.hpp
1#pragma once
2
3#ifdef __linux__
4#include <sys/epoll.h>
5#include <unistd.h>
6#endif
7
8#ifdef _WIN32
9#include <coroio/backends/wepoll.h>
10#endif
11
12#include <coroio/base.hpp>
13#include <coroio/poller.hpp>
14#include <coroio/socket.hpp>
15
16namespace NNet {
17
40class TEPoll: public TPollerBase {
41public:
46
61 void Poll();
62
63private:
64#ifdef __linux__
65 int Fd_;
66#endif
67
68#ifdef _WIN32
69 HANDLE Fd_;
70#endif
71
72 std::vector<THandlePair> InEvents_;
73 std::vector<uint32_t> Generations_;
74 std::vector<epoll_event> OutEvents_;
75};
76
77} // namespace NNet
~TEPoll()
Destructs the TEPoll instance and cleans up resources.
NNet::TSocket TSocket
Alias for the socket type.
Definition epoll.hpp:43
TEPoll()
Constructs the TEPoll instance.
NNet::TFileHandle TFileHandle
Alias for the file handle type.
Definition epoll.hpp:45
void Poll()
Polls for I/O events using the epoll API.
Asynchronous file handle that owns its file descriptor.
Definition socket.hpp:355
TPollerBase()=default
Default constructor.
High-level asynchronous socket for network communication.
Definition socket.hpp:404