Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




Loading

xTaskRestart()

Posted by Marcel van Lieshout on June 17, 2013
Would it be possible to extend the FreeRTOS with a TaskRestart() function? It can, of course, be done by calling vTaskDelete() and xTaskCreate() but a dedicated function would not need to first free and then re-allocate the memory. Heap_1.c would then still be usable.

RE: xTaskRestart()

Posted by woops_ on June 17, 2013
Can you use setjmp() and longjmp() in your task to do this?

RE: xTaskRestart()

Posted by Marcel van Lieshout on June 17, 2013
Probably. I could even breakout of the task loop and goto the beginning of the task function. But it would be nice if it could be done from another task.

RE: xTaskRestart()

Posted by Richard on June 17, 2013
Please add your request to the feature request tracker in sourceforge.

It might be possible for the kernel to call xTaskCreate() on the task again, effectively setting it back to its initial conditions using the same TCB and stack.

Regards.

RE: xTaskRestart()

Posted by Marcel van Lieshout on June 17, 2013
Done. :)

RE: xTaskRestart()

Posted by Richard Damon on June 17, 2013
I would add that I find very little use for a task to delete/restart another, and it is almost always a better way to make a bigger mess than to clean things up. The problem is that, unlike processes on "big" operating systems, there is very little clean up that FreeRTOS does (or even can do). Resources taken by the task are NOT returned. Semaphores or Mutexes (I believe) taken are not returned

Normally the desire for reason for wanting another task to kill a given task is that there is a concern that the task might have "crashed", but if that is really the case, the whole system state is really suspect, so the best thing to do is a full system restart. (perhaps a system with memory protection might be an exception).

I would think the more robust method would be for the task, when it is done with what it can do, is to suspend/block itself, and when another task has something for it to do that task resumes/unblocks the task. If you want to have a way to stop the task in the middle of its operation, it is easy enough to create a global flag that tasks can set to tell the task to abort its actions, and have the task check this frequently at points where it is safe to do so.

RE: xTaskRestart()

Posted by Marcel van Lieshout on June 18, 2013
You are right. I totally overlooked the cleanup that will not take place. I think it is better to drop this request.

Sorry...


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists