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

Hotfix for unwanted optimatisation #39

Merged
merged 2 commits into from Jun 5, 2019

Conversation

Projects
None yet
2 participants
@itzandroidtab
Copy link
Contributor

commented Jun 5, 2019

This removes an optimization that changes a while(!usart.available()) {} to a while(true) {} loop when !usart.available() is true. This uses a volatile size_t to store the size and the compiler will always reread the variable if in a said loop.

That said loops like while(!usart.available()) {} should be avoided as they are blocking. A better solution is just checking if new data is available and return if no data is available.

@itzandroidtab itzandroidtab merged commit db168d0 into master Jun 5, 2019

2 checks passed

Travis CI - Pull Request Build Passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@itzandroidtab itzandroidtab deleted the hotfix-while(available)_fix branch Jun 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.