Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created July 9, 2025 12:47
Show Gist options
  • Save rust-play/a180ee7413ffbee9104f560abb840005 to your computer and use it in GitHub Desktop.
Save rust-play/a180ee7413ffbee9104f560abb840005 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
use tokio::time::{Duration, sleep};
#[tokio::main]
async fn main() {
for _ in 0..1_000_000 {
tokio::spawn(async {
sleep(Duration::from_secs(1)).await;
});
}
println!("Spawned 1M tasks!");
sleep(Duration::from_secs(1)).await;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment