openMSX
Poller.hh
Go to the documentation of this file.
1 #ifndef POLLER_HH
2 #define POLLER_HH
3 
4 #include <atomic>
5 
6 namespace openmsx {
7 
13 class Poller
14 {
15 public:
16  Poller();
17  ~Poller();
18 
19 #ifndef _WIN32
23  [[nodiscard]] bool poll(int fd);
24 #endif
25 
28  [[nodiscard]] bool aborted() {
29  return abortFlag;
30  }
31 
34  void abort();
35 
36 private:
37 #ifndef _WIN32
38  int wakeupPipe[2];
39 #endif
40  std::atomic_bool abortFlag;
41 };
42 
43 } // namespace openmsx
44 
45 #endif
Polls for events on a given file descriptor.
Definition: Poller.hh:14
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:28
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