-
Notifications
You must be signed in to change notification settings - Fork 100
set timer_at to use relativce tics #75
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
set timer_at to use relativce tics #75
Conversation
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.
Looks good, mostly just cosmetic things (delete now-unused code rather than comment; commit fully to the interval approach in variable names/use).
Is there a Tock issue implementing the underlying syscall you could link here? The PRs should go together.
Thanks!
|
Thank you for the feedback, I made the changes. The PR supporting this has been already merged (tock/tock#1709). |
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.
I might be missing something, but on looking slightly more deeply, I think this may actually need to keep track of a notion of when things are expiring still. In the steady-state, just keeping intervals is sufficient. However, e.g. when a second timer is first introduced, it will need to know how far through the interval an existing timer is to decide whether to schedule itself after or before the existing time
| * the alarm is outstanding. | ||
| * | ||
| * \param expiration the clock value to schedule the alarm for. | ||
| * \param interval the clock value to schedule the alarm for. |
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.
| * \param interval the clock value to schedule the alarm for. | |
| * \param interval How far in the future to schedule the alarm. |
Probably want to move documentation away from implying an absolute clock value with the new interface
| alarm_t *prev = NULL; | ||
| while (*cur != NULL) { | ||
| if (cmp_exp(alarm->t0, alarm->expiration, (*cur)->expiration) < 0) { | ||
| if (cmp_exp(alarm->t0, alarm->interval, (*cur)->interval) < 0) { |
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.
Should this be referenced from alarm->t0 if comparing intervals now? I think this method of scheduling doesn't quite work anymore, this list ordering assumes a fixed time, but really we need to somehow understand what amount of an interval has expired when sorting the next one into the list.
|
Should be fixed by tock/tock#2089 ? |
This is the user space patch to try to fix tock/tock#1691.
The timer_at function now uses the new alarm system call and sets the timer to a relative numbers of tics. It eliminates the need to two extra system calls.
Any feedback is welcome, I am not sure that repeating_cb is correctly implemented now.