openMSX
Poller.hh
Go to the documentation of this file.
1#ifndef POLLER_HH
2#define POLLER_HH
3
4#include <array>
5#include <atomic>
6
7namespace openmsx {
8
14class Poller
15{
16public:
17 Poller();
18 ~Poller();
19
20#ifndef _WIN32
24 [[nodiscard]] bool poll(int fd);
25#endif
26
29 [[nodiscard]] bool aborted() {
30 return abortFlag;
31 }
32
35 void abort();
36
37private:
38#ifndef _WIN32
39 std::array<int, 2> wakeupPipe;
40#endif
41 std::atomic_bool abortFlag;
42};
43
44} // namespace openmsx
45
46#endif
Polls for events on a given file descriptor.
Definition Poller.hh:15
bool poll(int fd)
Waits for an event to occur on the given file descriptor.
Definition Poller.cc:43
bool aborted()
Returns true iff abort() was called.
Definition Poller.hh:29
void abort()
Aborts a poll in progress and any future poll attempts.
Definition Poller.cc:31
This file implemented 3 utility functions:
Definition Autofire.cc:9