FreeRTOS Support Archive
The FreeRTOS support forum is used to obtain active support directly from Real
Time Engineers Ltd. In return for using our top quality software and services for
free, we request you play fair and do your bit to help others too! Sign up
to receive notifications of new support topics then help where you can.
This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.
[FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [November 2007 Threads] 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.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|