dualcache_ff/spawner/mod.rs
1extern crate alloc;
2
3/// Trait for custom thread/task executors to spawn the background Daemon.
4///
5/// Decouples spawning from `DualCacheFF::new`, enabling execution on Tokio,
6/// FreeRTOS tasks, Loom virtual threads, or other user-defined runtimes.
7pub trait DaemonSpawner: Send + Sync {
8 /// Spawn a closure as a concurrent background execution unit.
9 fn spawn(&self, f: alloc::boxed::Box<dyn FnOnce() + Send + 'static>);
10}
11
12#[cfg(all(feature = "std", not(any(feature = "loom", loom))))]
13mod std_spawner;
14#[cfg(all(feature = "std", not(any(feature = "loom", loom))))]
15pub use std_spawner::DefaultSpawner;
16
17#[cfg(any(feature = "loom", loom))]
18mod loom_spawner;
19#[cfg(any(feature = "loom", loom))]
20pub use loom_spawner::DefaultSpawner;