19#ifndef EFI_UNIT_TEST_VERBOSE_ACTION
20#define EFI_UNIT_TEST_VERBOSE_ACTION 0
21#elif EFI_UNIT_TEST_VERBOSE_ACTION
30 : m_lateDelay(lateDelay)
32 for (
size_t i = 0; i < efi::size(
m_pool); i++) {
82 criticalError(
"No slots in scheduling pool");
104 scheduling->
action = action;
106 if (!
m_head || timeNt < m_head->getMomentNt()) {
108 LL_PREPEND2(
m_head, scheduling, nextScheduling_s);
129 if (!scheduling->
action) {
139 if (scheduling ==
m_head) {
148 while (current && current != scheduling) {
162 prev->nextScheduling_s = current->nextScheduling_s;
165 current->nextScheduling_s =
nullptr;
166 current->action = {};
210 int executionCounter = 0;
217 executionCounter += didExecute ? 1 : 0;
218 }
while (didExecute);
220 return executionCounter;
256extern bool unitTestBusyWaitHack;
257 if (unitTestBusyWaitHack) {
261 UNIT_TEST_BUSY_WAIT_CALLBACK();
269 auto const action{ std::move(current->
action) };
274#if EFI_DETAILED_LOGGING
275 printf(
"QUEUE: execute current=%d param=%d\r\n",
reinterpret_cast<uintptr_t
>(current), action.getArgumentRaw());
281#if EFI_DETAILED_LOGGING && EFI_UNIT_TEST_VERBOSE_ACTION
282 std::cout <<
"EventQueue::executeOne: " << action.getCallbackName() <<
"(" <<
reinterpret_cast<uintptr_t
>(action.getCallback()) <<
") with raw arg = " << action.getArgumentRaw() << std::endl;
298 LL_COUNT2(
m_head, tmp, result, nextScheduling_s);
303#if EFI_UNIT_TEST || EFI_SIMULATOR
309 if (counter++ > 1'000'000'000)
310 criticalError(
"EventQueue: looks like a loop?!");
323 LL_FOREACH2(
m_head, current, nextScheduling_s)
343 x->nextScheduling_s =
nullptr;
void assertListIsSorted() const
const efidur_t m_lateDelay
void tryReturnScheduling(scheduling_s *sched)
scheduling_s * m_freelist
scheduling_s * getElementAtIndexForUnitText(int index)
int executeAll(efitick_t now)
bool insertTask(scheduling_s *scheduling, efitick_t timeX, action_s const &action)
expected< efitick_t > getNextEventTime(efitick_t nowUs) const
scheduling_s * getFreeScheduling()
bool executeOne(efitick_t now)
EventQueue(efidur_t lateDelay=0)
void remove(scheduling_s *scheduling)
constexpr schfunc_t getCallback() const
static WrapAround62 timeNt
void firmwareError(ObdCode code, const char *fmt,...)
uint32_t maxEventCallbackDuration
@ OBD_PCM_Processor_Fault
@ EventQueueExecuteCallback
uint16_t schedulingUsedCount
scheduling_s * nextScheduling_s
efitick_t getMomentNt() const
void setMomentNt(efitick_t p_moment)
TunerStudioOutputChannels * getTunerStudioOutputChannels()