1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! `embedded-hal-async::delay::DelayNs` on top of the preemptive tier's
//! blocking sleep (plan.md Phase 15).
//!
//! This is a blocking implementation of an async trait — deliberately.
//! Rivet's preemptive tier has no "suspend this task, return control to
//! an executor" primitive the way the cooperative tier's `Sleep` does
//! (that one needs a *compile-time* duration, `Sleep<const MICROS: u64>`,
//! which doesn't fit `DelayNs`'s runtime-parameterized signature); what a
//! preemptive task actually does to give up the CPU for a while *is*
//! block (`rivet::preempt::sleep_ms`) — the scheduler runs something else
//! in the meantime, which is the same practical effect `.await`ing a real
//! async delay would have. A driver written against `DelayNs` works
//! correctly called from a preemptive task; it just isn't meaningful to
//! call from the cooperative executor's own task (blocking there would
//! stall every other cooperative task, exactly as blocking always would).
;