-
Notifications
You must be signed in to change notification settings - Fork 3k
Update events period method to check for invalid values #14087
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
Conversation
|
Please also rebase to the latest master to fix Travis |
Pull request has been modified.
The period method currently allows any ms value positive, negative and zero. A negative value means dispatch a non periodic event ie just once. 0 is unspecified behaviour. This commit forces the user to use either positive periods or a new constant non_periodic and should any other value be provided will default to non_periodic. A Greentea test case is also provided to check this works as expected.
non_periodic constant has been moved out of the Event class and made static within the events namespace so that it is available both internally within the class and externally. The MBED_ASSERT has been changed to MBED_WARNING. The greentea test has been updated: 1) timings reduced to make the test cases run faster 2) The call handler simplified
|
Hopefully rebased for travis fix also. |
|
Test results: |
|
@0xc0170 why does travis keep failing ? I rebased master :( |
evedon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two minor comments. The rest looks fine.
(Also minor whitespace correction)
|
Ci started |
|
@0xc0170 I can't see why astyle isn't happy? Any idea ? |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
|
@0xc0170 this was already approved and has passed CI (the whitespace push caused reviews to be dismissed). Just needs maintainer approval and merging now.. |
0xc0170
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
events/include/events/Event.h 100644 → 100755 - please revert the file attributes change
What file attribute changes ? And why would any of those changes need reverting they compile and run perfectly ? They're also fixing things that are currently wrong ? |
This reverts commit c9a3375.
|
here, it means that the files were marked as executable. This post can help: https://stackoverflow.com/questions/1257592/how-do-i-remove-files-saying-old-mode-100755-new-mode-100644-from-unstaged-cha?noredirect=1&lq=1 |
|
CI restarted |
Jenkins CI Test : ✔️ SUCCESSBuild Number: 3 | 🔒 Jenkins CI Job | 🌐 Logs & ArtifactsCLICK for Detailed Summary
|
|
This PR does not contain release version label after merging. |

Summary of changes
The period method currently allows any ms value:
positive, negative and zero.
A negative value means dispatch a non periodic event. ie just once.
0 is unspecified behaviour.
This commit forces the user to use either positive periods or a new constant, non_periodic
and should any other value be provided will default to non_periodic.
A Greentea test case is also provided to check this works as
expected.
I'm classifying this as a feature change rather than major because allowing a zero value was actually a bug.
Impact of changes
If the user provides a 0 value this will now behave differently. Previously it would have run for a period of
time as if this was an indefinite event before eventually (with a timer wrap) have unspecified behaviour.
Now the event period will default instead to non periodic.
To specify a non periodic event a user could previously use any negative value. Whilst this will still work (due a default
being set on invalid values), the user is encouraged to use the new constant, 'non_periodic' to show that this is what was
intended.
Migration actions required
Use periods that are > 0ms or non_periodic constant.
Documentation
Should be picked up automatically in the doxygen
Pull request type
Test results
Reviewers