Skip to content

Instantly share code, notes, and snippets.

@stepancheg
Created March 23, 2022 16:58
Show Gist options
  • Save stepancheg/0c1e6ed4b45a334a9a222e7db38537f2 to your computer and use it in GitHub Desktop.
Save stepancheg/0c1e6ed4b45a334a9a222e7db38537f2 to your computer and use it in GitHub Desktop.
#[tokio::main]
async fn main() {
let futs = (0..1000).map(|i| tokio::task::spawn(async move { i }));
for fut in futs {
# remove unconstraint, and it will block
let i = futures::executor::block_on(tokio::task::unconstrained(fut)).unwrap();
eprintln!("{}", i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment