Skip to content

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.

@aggarg
Copy link
Member

aggarg commented Nov 12, 2024

This seems a reasonable optimization. Thank you @jefftenney !

@sonarqubecloud
Copy link

@aggarg aggarg merged commit 8f7f451 into FreeRTOS:main Nov 12, 2024
@jefftenney jefftenney deleted the optimize-task-notifications branch November 12, 2024 14:58
moninom1 pushed a commit to moninom1/FreeRTOS-Kernel that referenced this pull request Sep 30, 2025
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