-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.
Description
A sleep_until
method for periodic timing without drifting is needed. In many cases this is much better to use than the sleep
function. The Ada Ravenscar profile even forbids the use of the delay
facility because it is so less predictable, and often leads to broken code. Currently, there is a periodic
method one can use but for more complicated cases one would still need the sleep_until
function.
Sample usage of the hypothetical sleep_until
:
fn periodic(t : Timer) {
let mut next_tick = time::precise_time_ns() / 100_000;
loop {
// .... Tick code
next_tick += 100;
timer.sleep_until(next_tick);
}
}
Wikipedia example of delay causing clock drift http://en.wikibooks.org/wiki/Ada_Style_Guide/Concurrency#Delay_Statements
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.