openMSX
CondVar.hh
Go to the documentation of this file.
1 #ifndef CONDVAR_HH
2 #define CONDVAR_HH
3 
4 #include <condition_variable>
5 #include <mutex>
6 
7 namespace openmsx {
8 
9 class CondVar
10 {
11 public:
14  void wait();
15 
20  bool waitTimeout(unsigned us);
21 
24  void signal();
25 
28  void signalAll();
29 
30 private:
31  std::mutex mutex;
32  std::condition_variable condition;
33 };
34 
35 } // namespace openmsx
36 
37 #endif
void signal()
Wake on thread that's waiting on this condtition variable.
Definition: CondVar.cc:20
void signalAll()
Wake all threads that are waiting on this condition variable.
Definition: CondVar.cc:25
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
void wait()
Block till another thread signals this condition variable.
Definition: CondVar.cc:7
bool waitTimeout(unsigned us)
Same as wait(), but with a timeout.
Definition: CondVar.cc:13