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
20 
23  bool poll(int fd);
24 #endif
25 
28  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
void abort()
Aborts a poll in progress and any future poll attempts.
Definition: Poller.cc:31
bool poll(int fd)
Waits for an event to occur on the given file descriptor.
Definition: Poller.cc:43
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
bool aborted()
Returns true iff abort() was called.
Definition: Poller.hh:28
Polls for events on a given file descriptor.
Definition: Poller.hh:13