Run sheduler fix number of times

Hello! I understand the question might be a bit odd, but is there maybe some nice way how I could run the whole system only a fixed number of iterations? Right now I have 2 tasks and I didn’t come up with anything better than just adding a for loop to each instead of while(1) and a** vTaskEndScheduler();** call in the end of each. So as I understand now the sheduler is switched off just by the first task which reachs the end. So could I somehow add the iterations for the whole system and not to each task in it?

Run sheduler fix number of times

Are you talking about the iterations of each task loop? If so, then they will not necessarily all be the same so you would have to choose one to count the number of iterations of. Or are you talking about the number of times the tick occurs, or the number of task switches, or something else internal to the scheduler – in which case you might be able to use a trace macro to count whatever the event of interest is and then stop the scheduler. Note vTaskEndScheduler() is not implemented for most ports as there is nothing to return to – it’s not like stopping a process to return to the Linux shell as there is no shell to return to.