dtact_util/timer/mod.rs
1//! Async timer primitives: sleep, interval, timeout.
2//!
3//! Two backends, selected the same way as [`crate::fs`]:
4//! - `native` (default): a single dedicated background thread that maintains
5//! a sorted list of pending deadlines and parks until the next one is due
6//! (see the module doc on `native` for why this — rather than a hashed
7//! timer wheel — was chosen for this pass).
8//! - `tokio` (when `native` is off): a thin wrapper over `tokio::time`.
9
10#[cfg(feature = "native")]
11mod native;
12#[cfg(feature = "native")]
13pub use native::*;
14
15// NOTE: named `tokio_backend`, not `tokio` - see fs/mod.rs / io/mod.rs for
16// why a local module literally named `tokio` shadows the extern crate.
17#[cfg(all(feature = "tokio", not(feature = "native")))]
18mod tokio_backend;
19#[cfg(all(feature = "tokio", not(feature = "native")))]
20pub use tokio_backend::*;