42 lines
1011 B
C++
42 lines
1011 B
C++
/*
|
|
* global_execution_queue.cpp
|
|
*
|
|
* @date Dec 8, 2018
|
|
* @author Andrey Belomutskiy, (c) 2012-2018
|
|
*/
|
|
|
|
#include "global_execution_queue.h"
|
|
|
|
bool_t debugSignalExecutor = false;
|
|
extern bool verboseMode;
|
|
|
|
void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) {
|
|
if (debugSignalExecutor) {
|
|
printf("scheduleTask %d\r\n", delayUs);
|
|
}
|
|
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, action);
|
|
}
|
|
|
|
int TestExecutor::executeAll(efitime_t now) {
|
|
return schedulingQueue.executeAll(now);
|
|
}
|
|
|
|
void TestExecutor::clear() {
|
|
schedulingQueue.clear();
|
|
}
|
|
|
|
int TestExecutor::size() {
|
|
return schedulingQueue.size();
|
|
}
|
|
|
|
scheduling_s* TestExecutor::getForUnitTest(int index) {
|
|
return schedulingQueue.getElementAtIndexForUnitText(index);
|
|
}
|
|
|
|
void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
|
if (debugSignalExecutor) {
|
|
printf("scheduleByTime %d\r\n", timeUs);
|
|
}
|
|
schedulingQueue.insertTask(scheduling, timeUs, action);
|
|
}
|