rusEFI
The most advanced open source ECU
|
#include <single_timer_executor.h>
Public Member Functions | |
SingleTimerExecutor () | |
void | scheduleByTimestampNt (const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override |
Schedule an action to be executed in the future. More... | |
void | cancel (scheduling_s *scheduling) override |
Cancel the specified scheduling_s so that, if currently scheduled, it does not execute. More... | |
void | onTimerCallback () |
Data Fields | |
int | timerCallbackCounter = 0 |
int | scheduleCounter = 0 |
int | maxExecuteCounter = 0 |
int | executeCounter |
int | executeAllPendingActionsInvocationCounter = 0 |
Private Member Functions | |
void | executeAllPendingActions () |
void | scheduleTimerCallback () |
Private Attributes | |
EventQueue | queue |
bool | reentrantFlag = false |
Definition at line 13 of file single_timer_executor.h.
SingleTimerExecutor::SingleTimerExecutor | ( | ) |
Definition at line 42 of file single_timer_executor.cpp.
|
overridevirtual |
Cancel the specified scheduling_s so that, if currently scheduled, it does not execute.
scheduling | The scheduling_s to cancel. |
Implements ExecutorInterface.
Definition at line 76 of file single_timer_executor.cpp.
Referenced by TriggerScheduler::scheduleEventsUntilNextTriggerTooth().
|
private |
Let's execute actions we should execute at this point. reentrantFlag takes care of the use case where the actions we are executing are scheduling further invocations
in real life it could be that while we executing listeners time passes and it's already time to execute next listeners. TODO: add a counter & figure out a limit of iterations?
Definition at line 95 of file single_timer_executor.cpp.
Referenced by onTimerCallback(), and scheduleByTimestampNt().
void SingleTimerExecutor::onTimerCallback | ( | ) |
Definition at line 83 of file single_timer_executor.cpp.
Referenced by globalTimerCallback().
|
overridevirtual |
Schedule an action to be executed in the future.
scheduleByAngle is useful if you want to schedule something in terms of crank angle instead of time.
msg | Name of this event to use for logging in case of an error. |
scheduling | Storage to use for the scheduled event. If null, one will be used from the pool. |
targetTime | When to execute the specified action. If this time is in the past or very near future, it may execute immediately. |
action | An action to execute at the specified time. |
Implements ExecutorInterface.
Definition at line 48 of file single_timer_executor.cpp.
Referenced by fireSparkAndPrepareNextSchedule(), runBench(), scheduleByAngle(), triggerScopeGetBuffer(), validateHardwareTimer(), and watchDogBuddyCallback().
|
private |
This method is always invoked under a lock
Let's grab fresh time value
Definition at line 139 of file single_timer_executor.cpp.
Referenced by onTimerCallback(), and scheduleByTimestampNt().
int SingleTimerExecutor::executeAllPendingActionsInvocationCounter = 0 |
Definition at line 24 of file single_timer_executor.h.
Referenced by executeAllPendingActions(), and executorStatistics().
int SingleTimerExecutor::executeCounter |
Definition at line 23 of file single_timer_executor.h.
Referenced by executeAllPendingActions(), and executorStatistics().
int SingleTimerExecutor::maxExecuteCounter = 0 |
Definition at line 22 of file single_timer_executor.h.
Referenced by executeAllPendingActions(), and executorStatistics().
|
private |
Definition at line 26 of file single_timer_executor.h.
Referenced by cancel(), executeAllPendingActions(), scheduleByTimestampNt(), and scheduleTimerCallback().
|
private |
Definition at line 27 of file single_timer_executor.h.
Referenced by executeAllPendingActions(), and scheduleByTimestampNt().
int SingleTimerExecutor::scheduleCounter = 0 |
Definition at line 21 of file single_timer_executor.h.
Referenced by executorStatistics(), and scheduleByTimestampNt().
int SingleTimerExecutor::timerCallbackCounter = 0 |
Definition at line 20 of file single_timer_executor.h.
Referenced by executorStatistics(), and onTimerCallback().