-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Timer::reset can't soundly have an optimized implementation #3027
Copy link
Copy link
Closed
Labels
A-rtArea: runtime traits/utilsArea: runtime traits/utilsC-performanceCategory: performance. This is making existing behavior go faster.Category: performance. This is making existing behavior go faster.E-easyEffort: easy. A task that would be a great starting point for a new contributor.Effort: easy. A task that would be a great starting point for a new contributor.
Milestone
Description
In 1.0.0-rc.1, the new Timer trait has a method to reset an existing Sleep to a new deadline. The default implementation simply creates a new Sleep and writes it over the old one, but presumably this method exists to it can be overridden with a better implementation when working with a timer like Tokio's that can have its deadline dynamically adjusted.
However, since the Sleep is provided as a dyn Sleep and Sleep has no downcasting APIs, there is no safe way to confirm that the Sleep instance is one created by this Timer implementation. That effectively means that the current default implementation is the only sound way of implementing the method.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-rtArea: runtime traits/utilsArea: runtime traits/utilsC-performanceCategory: performance. This is making existing behavior go faster.Category: performance. This is making existing behavior go faster.E-easyEffort: easy. A task that would be a great starting point for a new contributor.Effort: easy. A task that would be a great starting point for a new contributor.