feat(crux_time): cancellable timer #279
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi! I was playing around with the
time
capability and realised there's no way to clear the pending timer. This PR adds this possibility.This PR adds
TimeId
field for relevant requests/responses ofcrux_time
capability. Since we know the id of the timer we are able to clear it using the new time request:TimeRequest::Clear {id: TimeId}
. Once core notifies the shell (notify_shell
since we don't expect any response to this particular request) with this effect, the shell should fire the initially set timer sooner with aTimeResponse::Cleared
instead ofTimeResponse::InstantArrived
/TimeResponse::DurationElapsed
.I'm open to any suggestions, I'm also aware that this is a breaking change, maybe you guys see a non-breaking solution to this? Otherwise I will just create a custom capability 😉