Quality RTOS & Embedded Software

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


vTaskSuspend 2 Tasks

Posted by Paul on November 20, 2007
I want to suspend 2 tasks at the same time , but I cannot call vTaskSuspend twice .
example :

vTaskSuspend( Task1 );
vTaskSuspend( Task2 );


vTaskResume( Task2 );
vTaskResume( Task1 );

How can I suspend 2 tasks at the same time ?


RE: vTaskSuspend 2 Tasks

Posted by Richard on November 20, 2007
The API function only permits the suspension of one task at a time. If you want to atomically suspend two tasks then place the two calls in a critical section - but note this will only work if not suspending the current task as a critical section does not prevent a context switch.

Likewise, when resuming the tasks you would have to ensure that both tasks have lower priority than the task resuming them, otherwise a context switch would occur. This could be achieved by temporarily raising the priority of the calling task to above the priorities of the tasks being resumed.


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

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

Latest News

Version 10.1.0 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