The context switch between tasks is done only in the following synchronization points:
● When a task explicitly calls the scheduler. This is done by calling the following routine:scheduler()
If there are other ready tasks - one of them (chosen in a round-robin manner) becomes current, while the calling task becomes ready. If there is no other task ready, the calling task continues its execution.
● When a task calls await_for_event
service. The calling task then becomes delayed.
wait_for_event(EVENT)
event *EVENT;