Periodic tasks in Ada
We did this in the previous lecture (under ‘Previous Activity’)
Aperiodic and Sporadic Activities in Ada
Again, covered these definitions in the previous lecture. To clarify; sporadic has a minimum inter-arrival time, otherwise it’s aperiodic.
For Aperiodics in Ada you need a task and a protected object. The protected object holds the trigger event that will trigger the release of the task. Then, the task just:
loop
Aperiodic_Controller.Wait_For_Next_Interrupt;
--action
end loop
Where Aperiodic_Controller
is a protected object with a boolean variable as the barrier for entry.
Tasks and Events
You can use Tasks, or Events, for doing this sort of thing.
- Tasks are long lived with state, they repeat.
- Events are one-off and have no state.
Interrupts are events.
Timing Events
NEW (apparently). Timing events happen when a defined clock reaches a specified value. This is supported by the Ada.Real_Time.Timing_Events
package. Apparently this package is also a good example of how newer packages look in Ada (the style, that is).