From 311291b95adbd24ecd037f5e555e4c30138f4339 Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sat, 20 May 2023 12:02:51 +0200 Subject: Make Monotonic implementation more obvious --- book/en/src/by-example/delay.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'book/en/src/by-example/delay.md') diff --git a/book/en/src/by-example/delay.md b/book/en/src/by-example/delay.md index a6ad0e0..09091fc 100644 --- a/book/en/src/by-example/delay.md +++ b/book/en/src/by-example/delay.md @@ -6,6 +6,8 @@ This can be achieved by instantiating a monotonic timer (for implementations, se [`rtic-monotonics`]: https://github.com/rtic-rs/rtic/tree/master/rtic-monotonics [`rtic-time`]: https://github.com/rtic-rs/rtic/tree/master/rtic-time +[`Monotonic`]: https://docs.rs/rtic-time/latest/rtic_time/trait.Monotonic.html +[Implementing a `Monotonic`]: ../../monotonic_impl.md ``` rust,noplayground ... @@ -25,12 +27,6 @@ async fn foo(_cx: foo::Context) { ``` - - -Technically, the timer queue is implemented as a list based priority queue, where list-nodes are statically allocated as part of the underlying task `Future`. Thus, the timer queue is infallible at run-time (its size and allocation are determined at compile time). - -Similarly the channels implementation, the timer-queue implementation relies on a global *Critical Section* (CS) for race protection. For the examples a CS implementation is provided by adding `--features test-critical-section` to the build options. -
A complete example @@ -48,6 +44,9 @@ $ cargo run --target thumbv7m-none-eabi --example async-delay --features test-cr
+> Interested in contributing new implementations of [`Monotonic`], or more information about the inner workings of monotonics? +> Check out the [Implementing a `Monotonic`] chapter! + ## Timeout Rust [`Future`]s (underlying Rust `async`/`await`) are composable. This makes it possible to `select` in between `Futures` that have completed. -- cgit v1.2.3