Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Context switch from co-routine

Posted by Andrei on July 30, 2011
Hi all.

static void __interrupt __far vExampleInterruptHandler( void )
&pxCoRoutineWoken );

if( pxCoRoutineWoken == pdTRUE )

Can I use vCoRoutineSchedule() API function???


RE: Context switch from co-routine

Posted by Richard Damon on July 30, 2011
Note that co-routines do not support preemption, so the interrupt can't change which co-routine is running.

RE: Context switch from co-routine

Posted by Andrei on July 31, 2011
To richard_damon:

But I can change current coroutine to other by call crDELAY(xHandle, 0);
It will be correct, if I could do the same from ISR...

How to use parameter pxCoRoutineWoken in crQUEUE_RECEIVE_FROM_ISR() API function?
What for is this parameter?


RE: Context switch from co-routine

Posted by Richard Damon on July 31, 2011
Since Co-Routines do not support pre-emption, the switch between co-routines occurs when the co-routine calls an API function. They don't save enough state to allow a co-routine to be interrupted at another point and the flow of execution changed (to another co-routine). In effect, all the co-routines in a program fall within a single task, and that task can be pre-empted, so another task can run. This is what the Woken flag controls, should the "co-routine" task be woken by the interrupt.

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

Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers


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

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

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner