FreeRTOS / FreeRTOS-Kernel

FreeRTOS kernel files only, submoduled into https://github.com/FreeRTOS/FreeRTOS and various other repos.
https://www.FreeRTOS.org
MIT License
2.5k stars 1.05k forks source link

[BUG] When configUSE_PREEMPTION=0, removing own task does not switch to another task #1091

Open koichimatsuno opened 2 weeks ago

koichimatsuno commented 2 weeks ago

Describe the bug

In Windows, if the SuspendThread is called during thread execution, it may deadlock, so I configure configUSE_PREEMPTION=0 and use the taskYIELD.

When removing own task using the vTaskDelete in this environment, a symptom occurs that the task does not switch to another task after the task is removed.

In the vTaskDelete, the taskYIELD_WITHIN_API is called, but is the process of setting xSwitchRequired to TRUE in the xTaskIncrementTick missing?

Target

Expected behavior

rawalexe commented 2 weeks ago

Thank you for reaching out and pointing out the bug, I see you are also providing a patch, can you please create a PR against it so that we can go through the formal PR review and you will also get credit for it.

Best Regards, AR