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

[fiber] Improve timing of poll functions #1196

Merged
merged 2 commits into from
Aug 13, 2024

Conversation

salkinium
Copy link
Member

@salkinium salkinium commented Aug 9, 2024

There are two problems with the poll functions:

  1. Calling sleep_for with nanoseconds (or less) durations would be cast to 0us or 0ms. This is now fixed by making the duration at least 1us or 1ms. (cc @TomSaw)
  2. The condition was not checked again after a yield, thus can time out if the yield takes longer. The correct behavior should check the function upon entry of the poll for a fast exit and then again after each yield before checking the timeout.
  3. Fix infinite loop when passing 0s as sleep time, whoops. Now it only yields once.
  • Implementation
  • Documentation
  • Add Unit Tests

@salkinium salkinium added this to the 2024q3 milestone Aug 9, 2024
@salkinium salkinium force-pushed the fix/fiber_poll_functions branch 3 times, most recently from acfd220 to 0fef334 Compare August 9, 2024 22:45
@salkinium salkinium merged commit 1319de9 into modm-io:develop Aug 13, 2024
12 checks passed
@salkinium salkinium deleted the fix/fiber_poll_functions branch August 13, 2024 20:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

1 participant