COROIO: coroio/poll.hpp Source File
COROIO
 
Loading...
Searching...
No Matches
poll.hpp
1#pragma once
2
3#ifdef _WIN32
4#include <winsock2.h>
5#else
6#include <poll.h>
7#endif
8
9#include <assert.h>
10
11#include <iostream>
12
13#include "base.hpp"
14#include "poller.hpp"
15#include "socket.hpp"
16
17namespace NNet {
18
39class TPoll: public TPollerBase {
40public:
45
46#ifdef _WIN32
53 TPoll();
54#endif
55
63 void Poll();
64
65private:
72 std::vector<std::tuple<THandlePair,int>> InEvents_;
78 std::vector<pollfd> Fds_;
79#ifdef _WIN32
85 TSocket DummySocket_;
86#endif
87};
88
89} // namespace NNet
Asynchronous file handle that owns its file descriptor.
Definition socket.hpp:317
Poller implementation based on the poll() system call.
Definition poll.hpp:39
NNet::TFileHandle TFileHandle
Alias for the file handle type.
Definition poll.hpp:44
void Poll()
Polls for I/O events.
NNet::TSocket TSocket
Alias for the socket type.
Definition poll.hpp:42
TPollerBase()=default
Default constructor.
High-level asynchronous socket for network communication.
Definition socket.hpp:364