Calling vTaskStartScheduler and vTaskEndScheduler

csanikita92 wrote on Wednesday, June 13, 2018:

Hi,

Is it possible to have something like:

int main() {
vTaskStartScheduler();
.
.
// some task calls vTaskEndScheduler();

             .
  vTaskStartScheduler();
                  ..
                  ..
  // some task calls  vTaskEndScheduler();

}

in an application?

That is, after an application calls vTaskStartScheduler and then a task calls vTaskEndScheduler, can the application call vTaskStartScheduler again?

We are performing a static data race detection and data flow analysis on FreeRTOSv10.0.0 which assumes that such a situation will never arise. Is our assumption correct or not?

Thanks,
Nikita

rtel wrote on Wednesday, June 13, 2018:

Very few ports implement vTaskEndScheduler(), perhaps only the Windows
and DOS ports. I think in the Windows case ending the scheduler
terminates the process, so code after vTaskStartScheduler() will never
run. I can’t recall what happens in the DOS case as the port is about
15 years old but I think FreeRTOS replaces DOS in memory and then uses a
setjmp/lngjmp pair to exit the scheduler - not sure where it goes from
there though.