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] [April 2011 Threads] Query about task deletionPosted by rammbhat on April 16, 2011 I had a basic query about task deletion in freertos. Can we delete a task from within a task? as in last line will be the vTaskDelete call.. What argument do you pass? Also the documentation says that the memory for the deleted task is only deleted when the idle task is run.. Is there any other way to do this?
RE: Query about task deletionPosted by Richard on April 16, 2011 A task can delete itself by calling either
vTaskDelete( NULL );
or
vTaskDelete( my_handle ),
where my_handle is a variable of type xTaskHandle that holds the calling tasks handle.
The memory allocated to the task for the task stack and task control block are freed the next time the idle task runs. That is currently the only way it is done.
Regards.
RE: Query about task deletionPosted by Richard on April 16, 2011 Reading your question again - if you mean can one task delete another task (rather than itself), then "yes" it can. The parameter to vTaskDelete() is the handle of the task you are deleting. Task handles can be obtained using the last parameter of the xTaskCreate() call used to create the task in the first place.
Regards.
RE: Query about task deletionPosted by rammbhat on April 16, 2011 Thanks for that.. Maybe an api call to delete allocated memory in a future release ? :)
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|