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

Don't suspend scheduler if task already notified #1190

Merged
merged 3 commits into from
Nov 12, 2024

Conversation

jefftenney
Copy link
Contributor

Description

Apply a small optimization to recent changes to xTaskNotifyWait() and ulTaskNotifyTake(). Prior to this PR, these functions suspend and resume the scheduler for all executions. After this PR, these functions suspend the scheduler only if the task is not already notified, and only if the caller is willing to wait for the notification.

Checklist:

  • I have tested my changes. No regression in existing tests.
  • I have modified and/or added unit-tests to cover the code changes in this Pull Request.

Related Issue

Prior to #833, these functions never suspended the scheduler but used a critical section only. After #833, these functions suspended the scheduler but only as needed (eg, the task wasn't already notified). Then #982 cleaned up the implementation but also resulted in suspending the scheduler for every call to these functions.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@jefftenney
Copy link
Contributor Author

No worries if you don't want to merge this. It took the same amount of time to make the PR as to ask if you would be interested in it.

tasks.c Outdated Show resolved Hide resolved
@aggarg
Copy link
Member

aggarg commented Nov 12, 2024

This seems a reasonable optimization. Thank you @jefftenney !

Copy link

sonarcloud bot commented Nov 12, 2024

@aggarg aggarg merged commit 8f7f451 into FreeRTOS:main Nov 12, 2024
16 checks passed
@jefftenney jefftenney deleted the optimize-task-notifications branch November 12, 2024 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants