1use native_executor::{Priority, spawn, spawn_with_priority, timer::Timer};
2use std::time::Duration;
3
4fn main() {
5 spawn(async {
7 println!("Default priority task started");
8 Timer::after_secs(1).await;
9 println!("Default priority task completed");
10 })
11 .detach();
12
13 spawn_with_priority(
15 async {
16 println!("Background priority task started");
17 Timer::after_secs(1).await;
18 println!("Background priority task completed");
19 },
20 Priority::Background,
21 )
22 .detach();
23
24 std::thread::sleep(Duration::from_secs(2));
26}