Which FreeRTOS Function To Use?

groufosse wrote on Monday, March 11, 2013:

Hi,
After reading throught the FreeRTOS “A Guide…”  I’m still unsure just the right way to implement what I’m needing to do, and hoping for some advice. It’s fairly straightforward:

Task 1 runs every 30 seconds.
When Task 2 runs, I need to suspend just Task 1 (no other task) until Task 2 is complete.

What’s the best way to do this?

Thank you for any tips on implementing this.

groufosse wrote on Monday, March 11, 2013:

BTW - I should have noted that Task 2 runs non-scheduled (non-deterministic)

friedl wrote on Monday, March 11, 2013:

If task 1 can be suspended at any time, then just
assign task 2 a higher priority and it will suspend
task 1 every time it runs.

richard_damon wrote on Tuesday, March 12, 2013:

It isn’t totally clear what you mean, as, has been commented, if Task 2 has a higher priority than Task 1, then when ever task 2 is running task 1 is not (since FreeRTOS doesn’t to my knowledge support multi-core processors). If what you mean is that every time you create a copy of Task2 with vTaskCreate or signal a semaphore/queue that Task2 is waiting on, you want Task 1 suspended until Task2 gets ready to end/block again, then use vTaskSuspend/Resume in Task2, with Task 1 as the target.