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



Posted by incrediball on January 23, 2009
The documentation states the following: "API functions that have the potential to cause a context switch must not be called while the scheduler is suspended". Does this include interrupts that call portYIELD_FROM_ISR? For example if xSemaphoreGiveFromISR is called and the parameter pxHigherPriorityTaskWoken is set to pdTRUE should portYIELD_FROM_ISR NOT be called if the scheduler is currently suspended?

If this is the case then this should perhaps be explicitly noted because code between vTaskSuspendAll and xTaskResumeAll may not be calling any API functions and the problem would not be very obvious...

RE: vTaskSuspendAll

Posted by Richard on January 23, 2009
There is no problem with interrupts attempting to yield while the scheduler is suspended, or interrupts reading and writing to queues/semaphores. The scheduler takes care of these situations.

If an interrupts attempts to yield then the yield is held pending until the scheduler is resumed. Pending yields are actually performed within xTaskResumeAll().


RE: vTaskSuspendAll

Posted by incrediball on January 26, 2009
In that case would it be possible to allow yields and calls to functions that can cause context switches between vTaskSuspendAll and xTaskResumeAll? These would just become pending yields in the same way as with yields in an ISR. Then the only thing that wouldn't be allowed would be blocking calls.

Just an idea. Not sure how useful this would be...

RE: vTaskSuspendAll

Posted by Richard on January 26, 2009
In some cases it is ok to yield when the scheduler is suspended, and in some cases not, hence the statement you referred to about not doing it.

Sometimes the logic of a program relies on a yield being performed at the correct time. The queue code is one place this is the case (when the queue is empty or full - it would make no sense for a yield at this time to be pended - also when deleting a task, once the tasks has been deleted a yield must occur away from the task, there are other examples).


[ 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