FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! 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.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [May 2014 Threads] FreeRTOS xTaskStartScheduler Posted by jirachi2 on May 16, 2014 I have a question. If I create a task with xTaskCreate(), and then start the scheduler with xTaskStartScheduler(), can I later on add new tasks? I think I can't because I have to set the priority in xTaskCreate.. and then it would mess up the priority of others maybe?
So If I cant, I have to create ALL tasks before I start the scheduler?
And can I later on delete tasks while the scheduler is running?
FreeRTOS xTaskStartScheduler Posted by rtel on May 16, 2014 You can create tasks before or after the scheduler has been started.
You can delete tasks after the scheduler has been started.
The following rather old (and interestingly still using version 7.x types in places) standard demo does nothing but create and delete tasks while the scheduler is running:
https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/Common/Minimal/death.c
Note if you delete tasks you must allow the idle task to run occasionally as it performs some clean up.
Regards.
FreeRTOS xTaskStartScheduler Posted by jirachi2 on May 16, 2014 Thanks! If I create a task with xTaskCreate() after the scheduler has started, does the new task automatically run? Don't I have to call startScheduler() again or something alike?
FreeRTOS xTaskStartScheduler Posted by rtel on May 16, 2014 vTaskStartScheduler() should only ever be called once. Any tasks created after the scheduler has started will automatically be added to the pool of tasks that are available to the scheduler, and will in fact run immediately if the task being created is given a priority that is higher than the task that created it.
Look at the example in the link already posted above.
Regards.
FreeRTOS xTaskStartScheduler Posted by jirachi2 on May 16, 2014 Thanks. Least number is least priority? Highest number is highest priority? Or the other way around? ( i guess least is least priority, because often you don't know how many threads in the future are created))
FreeRTOS xTaskStartScheduler Posted by rtel on May 16, 2014 Answers to all the questions you have asked so far can be found in the online docs.
http://www.freertos.org/RTOS-task-priority.html
Regards.
FreeRTOS xTaskStartScheduler Posted by jirachi2 on May 16, 2014 I have another question.
For example, I have 1 class called Menu.cpp. The header looks like:
- Menu()
- void foo()
In the contrustor I create 1 task. This task just does random code (it doesn't matter). Then in the constructor, after the task is created, I call vTaskStartScheduler().
The Main looks like:
{
Menu menu;
menu.foo();
}
Will the code get to menu.foo(); ? I don't know, because I read somewhere the code does not go past vTaskStartScheduler() unless there is a fatal error.
FreeRTOS xTaskStartScheduler Posted by davedoors on May 16, 2014 http://www.freertos.org/a00132.html
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|