Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
koichimatsuno opened this issue Jun 12, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@koichimatsuno
Copy link

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

  • Windows10
  • Visual Studio 2022

Expected behavior

  • After removing own task, another task is executed.
  • Applying the FreeRTOS_v11.1.0.patch to FreeRTOS_v11.1.0 worked as expected.
@koichimatsuno koichimatsuno added the bug Something isn't working label Jun 12, 2024
@rawalexe
Copy link
Member

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

@aggarg
Copy link
Member

aggarg commented Aug 29, 2024

In the vTaskDelete, the taskYIELD_WITHIN_API is called

The problem is that taskYIELD_WITHIN_API does not get called for the Windows port and that is why the next task does not get scheduled.

This PR fixes the issue by recording a yield in the portPRE_TASK_DELETE_HOOK.

Thank you for reporting this.

@aggarg
Copy link
Member

aggarg commented Aug 29, 2024

I am closing this issue as the PR has been merged. Feel free to reopen if you need anything from us.

@aggarg aggarg closed this as completed Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants