richard_damon wrote on Wednesday, May 18, 2016:
If you want to terminate the task to be created again fresh for another job, just have the task delete itself: vTaskDelete(0);
Normally, I don’t keep deleting and creating tasks, as it is inefficient, but the task has out the outer level a while(1) loop, and at the top of that loop something that causes the task to block until it has something to do (a vTaskDelay, or wait on a semaphore/event flag, or get from a queue). If at some point in processing, I am done and want to wait for the next operation, you just use a continue statement.
If you want to use a return, just make that part of the code a function that the main loop of the task calls, then THAT function can return and the main loop goes up to wait again.