FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

Delete Tasks

I want to build a state machine. Task 1 and Task 2 start and will be processed. Once these have been processed Task3 should be executed. Then everything will repeat itself. problem: The tasks are executed only once.

RE: Delete Tasks

RE: Delete Tasks

First a comment on design, do NOT just wildly create and delete tasks, this is almost always a wrong solution.

One big problem I see with your code is your Zustandmanager task continually runs creating tasks. It may get held for a moment as the tasks that it creates run, but it will never give up the processor for the idle task, and that means that the tasks that are deleted are never cleaned up from, so you WILL run out of memory.

Second, if your goal is for tasks 1 & 2 to run, and when they finish for task 3 to run, and when it finishes tasks 1&2 to run again and so on, then none of these tasks should be deleted, but should just wait on semaphores to tell them when to go, and then as tasks finish they set the appropriate semaphore to tell the next task to go.