2015-07-10 06:01:56 -07:00
|
|
|
/**
|
2019-03-29 06:11:13 -07:00
|
|
|
* @file single_timer_executor.h
|
2015-07-10 06:01:56 -07:00
|
|
|
*
|
|
|
|
* @date: Apr 18, 2014
|
2020-01-13 18:57:43 -08:00
|
|
|
* @author Andrey Belomutskiy, (c) 2012-2020
|
2015-07-10 06:01:56 -07:00
|
|
|
*/
|
|
|
|
|
2020-01-20 22:40:11 -08:00
|
|
|
#pragma once
|
2015-07-10 06:01:56 -07:00
|
|
|
|
|
|
|
#include "scheduler.h"
|
|
|
|
#include "event_queue.h"
|
|
|
|
|
2020-10-16 08:04:27 -07:00
|
|
|
class SingleTimerExecutor final : public ExecutorInterface {
|
2015-07-10 06:01:56 -07:00
|
|
|
public:
|
2019-01-08 22:07:50 -08:00
|
|
|
SingleTimerExecutor();
|
2020-01-06 21:41:18 -08:00
|
|
|
void scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
2020-01-09 12:45:13 -08:00
|
|
|
void scheduleByTimestampNt(scheduling_s *scheduling, efitime_t timeNt, action_s action) override;
|
2020-01-06 21:41:18 -08:00
|
|
|
void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override;
|
2015-07-10 06:01:56 -07:00
|
|
|
void onTimerCallback();
|
2020-06-14 20:34:45 -07:00
|
|
|
int timerCallbackCounter = 0;
|
|
|
|
int scheduleCounter = 0;
|
2020-12-17 19:21:12 -08:00
|
|
|
int maxExecuteCounter = 0;
|
|
|
|
int executeCounter;
|
2020-06-14 20:34:45 -07:00
|
|
|
int executeAllPendingActionsInvocationCounter = 0;
|
2015-07-10 06:01:56 -07:00
|
|
|
private:
|
|
|
|
EventQueue queue;
|
2020-06-14 20:34:45 -07:00
|
|
|
bool reentrantFlag = false;
|
|
|
|
void executeAllPendingActions();
|
2015-07-10 06:01:56 -07:00
|
|
|
void scheduleTimerCallback();
|
|
|
|
};
|
|
|
|
|
2019-02-27 14:12:52 -08:00
|
|
|
void initSingleTimerExecutorHardware(void);
|
2017-06-07 19:55:05 -07:00
|
|
|
void executorStatistics();
|
2015-07-10 06:01:56 -07:00
|
|
|
|