openMSX
RTScheduler.hh
Go to the documentation of this file.
1#ifndef RTSCHEDULER_HH
2#define RTSCHEDULER_HH
3
4#include "SchedulerQueue.hh"
5#include "Timer.hh"
6#include <cstdint>
7
8namespace openmsx {
9
10class RTSchedulable;
11
13{
14 uint64_t time;
16};
17
19{
20public:
22 inline void execute()
23 {
24 if (!queue.empty()) {
25 auto limit = Timer::getTime();
26 if (limit >= queue.front().time) [[unlikely]] {
27 scheduleHelper(limit); // slow path not inlined
28 }
29 }
30 }
31
32private:
33 // These are called by RTSchedulable
34 friend class RTSchedulable;
35 void add(uint64_t delta, RTSchedulable& schedulable);
36 bool remove(RTSchedulable& schedulable);
37 [[nodiscard]] bool isPending(const RTSchedulable& schedulable) const;
38
39 void scheduleHelper(uint64_t limit);
40
41private:
43};
44
45} // namespace openmsx
46
47#endif
void execute()
Execute all expired RTSchedulables.
uint64_t getTime()
Get current (real) time in us.
Definition Timer.cc:7
This file implemented 3 utility functions:
Definition Autofire.cc:11
RTSchedulable * schedulable