Quality RTOS & Embedded Software

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




Loading

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 ?

Thanks!

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.

Regards.


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




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

Latest News

FreeRTOS kernel V10 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

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