59 handlers_.remove(mdh);
109 handlers_.remove(mdh);
131 const MonotonicTime earliest =
min(deadline_scheduler_.getEarliestDeadline(), spin_deadline);
135 if (earliest - ts > deadline_resolution_)
137 return ts + deadline_resolution_;
146 const MonotonicTime deadline = prev_cleanup_ts_ + cleanup_period_ * (num_frames_processed_with_last_spin + 1);
147 if (mono_ts > deadline)
150 prev_cleanup_ts_ = mono_ts;
151 dispatcher_.cleanup(mono_ts);
160 return -ErrRecursiveCall;
168 const MonotonicTime dl = computeDispatcherSpinDeadline(deadline);
169 retval = dispatcher_.spin(dl);
176 pollCleanup(ts,
unsigned(retval));
191 return -ErrRecursiveCall;
196 const int retval = dispatcher_.spinOnce();
203 pollCleanup(ts,
unsigned(retval));
void startWithDeadline(MonotonicTime deadline)
void pollCleanup(MonotonicTime mono_ts, uint32_t num_frames_processed_with_last_spin)
virtual MonotonicTime getMonotonic() const =0
MonotonicTime getEarliestDeadline() const
MonotonicTime getMonotonicTime() const
bool operator()(const DeadlineHandler *t) const
MonotonicTime pollAndGetMonotonicTime(ISystemClock &sysclock)
bool doesExist(const DeadlineHandler *mdh) const
void startWithDelay(MonotonicDuration delay)
MonotonicDeadlineHandlerInsertionComparator(MonotonicTime arg_ts)
MonotonicTime computeDispatcherSpinDeadline(MonotonicTime spin_deadline) const
static MonotonicTime getMax()
T * getNextListNode() const
void add(DeadlineHandler *mdh)
MonotonicTime getDeadline() const
UAVCAN_EXPORT const T & min(const T &a, const T &b)
void remove(DeadlineHandler *mdh)
int spin(MonotonicTime deadline)
virtual void handleDeadline(MonotonicTime current)=0
DeadlineScheduler & getDeadlineScheduler()