rusefi/unit_tests/global_execution_queue.cpp

43 lines
1023 B
C++
Raw Normal View History

2018-12-08 15:11:28 -08:00
/*
* global_execution_queue.cpp
*
* @date Dec 8, 2018
* @author Andrey Belomutskiy, (c) 2012-2018
*/
#include "signal_executor.h"
#include "event_queue.h"
#include "global_execution_queue.h"
2018-12-08 15:11:28 -08:00
// this global instance is used by integration tests via 'scheduleByTimestamp' global methods below
EventQueue schedulingQueue;
bool_t debugSignalExecutor = false;
TestExecutor::TestExecutor() {
}
void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
if (debugSignalExecutor) {
printf("scheduleTask %d\r\n", delayUs);
}
scheduleByTimestamp(scheduling, getTimeNowUs() + delayUs, callback, param);
}
void TestExecutor::clear() {
schedulingQueue.clear();
}
void TestExecutor::scheduleByTimestamp(scheduling_s *scheduling, efitimeus_t timeUs, schfunc_t callback, void *param) {
2018-12-08 15:11:28 -08:00
if (debugSignalExecutor) {
printf("scheduleByTime %d\r\n", timeUs);
2018-12-08 15:11:28 -08:00
}
schedulingQueue.insertTask(scheduling, timeUs, callback, param);
2018-12-08 15:11:28 -08:00
}
void initSignalExecutorImpl(void) {
}