nngn
Loading...
Searching...
No Matches
poller.h
Go to the documentation of this file.
1#ifndef NNGN_SCRIPTS_WORKER_H
2#define NNGN_SCRIPTS_WORKER_H
3
4#include <array>
5#include <poll.h>
6
7class Poller {
8 std::array<int, 2> pipe_fds = {-1, -1};
9 std::array<pollfd, 2> poll_fds = {};
10public:
11 enum class result : uint8_t { ERR, DONE, CANCELLED, READ };
12 bool init();
13 bool destroy();
14 bool finish();
15 result poll(int fd);
16};
17
18#endif
Definition poller.h:7
std::array< int, 2 > pipe_fds
Definition poller.h:8
std::array< pollfd, 2 > poll_fds
Definition poller.h:9
bool destroy()
Definition poller.cpp:25
bool finish()
Definition poller.cpp:35
bool init()
Definition poller.cpp:13
result poll(int fd)
Definition poller.cpp:44
result
Definition poller.h:11
std::chrono::duration< float, typename T::period > fd
Definition timing.cpp:8