-
Notifications
You must be signed in to change notification settings - Fork 14
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
✨ Add periodic
adapter
#152
base: main
Are you sure you want to change the base?
Conversation
45c014b
to
4205032
Compare
Problem: - There is no way to periodically run a sender without drift. Solution: - Introduce `periodic`, `periodic_n`, and `periodic_until`. Notes: - `periodic` interacts with the durationless time_scheduler. On first `start`, it schedules an expiry time of `now + duration`. On subsequence `start`s, it schedules an expiry time of `previous expiry + duration`. In this way it eliminates drift caused by the small amount of time taken to manage the timer interrupt. - The `get_expiration` query returns an `expiration_provider` rather than a bare expiration time because computing an expiration time typically involves calling `HAL::now()`, which entails making sure that `HAL::enable` has been called.
|
||
TEST_CASE("periodic propagates forwarding queries to its child environment", | ||
"[periodic]") { | ||
auto s = custom_sender{}; |
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.
question: This doesn't seem to be testing anything in periodic. What am I missing?
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.
Line 88 is testing periodic; like 85 is the basis. It's testing that periodic correctly handles a forwarding query to its attributes.
@@ -12,11 +13,25 @@ constexpr inline struct get_expiration_t : forwarding_query_t { | |||
constexpr static auto name = stdx::ct_string{"get_expiration"}; | |||
|
|||
template <typename T> | |||
requires true |
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.
question: What does this do?
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.
It more tightly constrains this overload versus the one on line 28.
Problem:
Solution:
periodic
,periodic_n
, andperiodic_until
.Notes:
periodic
interacts with the durationlesstime_scheduler
. On firststart
, it schedules an expiry time ofnow + duration
. On subsequentstart
s, it schedules an expiry time ofprevious expiry + duration
. In this way it eliminates drift caused by the small amount of time taken to manage the timer interrupt.get_expiration
query returns anexpiration_provider
rather than a bare expiration time because computing an expiration time typically involves callingHAL::now()
, which entails making sure thatHAL::enable()
has been called.