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] [May 2005 Threads] Context switching in cooperative modePosted by Nobody/Anonymous on May 31, 2005 Hello,
Do calls to cQueueSend, cQueueReceive cause a context switch when FreeRTOS is running in cooperative mode, or is an explicit call to vPortYield() in the task code required to do this. The reason I ask is because calls to taskYIELD() appear in the cQueueSend(), cQueueReceive() functions, but I don't know if these will be called when in cooperative mode.
Thanks Khusro
RE: Context switching in cooperative modePosted by Nobody/Anonymous on May 31, 2005 Calling these functions will implicitly call Yield, as you say. A switch will occur if the call unblocks a task that has higher priority than the calling task.
You could modify the code to prevent this if you wanted - I think you would need to ensure that the function xTaskResumeAll() in tasks.c (or cTaskResumeAll() depending on your version) always returns false if the cooperative scheme was being used. Also remove the yield from within the xTaskResumeAll function itself.
To test for the cooperative scheme you can use #if configUSE_PREEMPTION == 1
Or you could design the tasks and priorities such that a yield will have no effect.
The cooperative scheme just prevents the tick causing a switch. The application then has control by either calling yield or an api function that will cause a yield.
Hope this helps.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|