Switch between tasks immediately with a notify API or other solution

HI,

I’m working on my first big project, and I’ve run into an issue.

The requirements are to implement such functionality that when I send a Notify from Task01 to Task02, then immediately Task 2 will run (Task02 in Blocking Mode due to NotifyWait).
then only when Task02 finishes and again waits for Notify, then Task01 continues from the same point.

Thanks!
Zohar

Just make Task 2 a higher priority than Task 1 and it will work as expected.

One quick comment, if the definition really is that task1 runs until it gets to a given point, and then you switch to task2, and task1 gets no time (even if it blocks for some I/O) until it is done, then it really make sense to combine those two tasks into just a single task.

Adding to RealtimeRik’s answer - if the notification if from an interrupt then make sure to use the xHigherPriorityTaskWoken parameter (always the last parameter in any of the ‘FromISR’ functions) - otherwise the context switch will not occur until the next tick interrupt. Check the API docs for an example.