From a9b970c8ec36bf248ede21791c8ac51bac4546b4 Mon Sep 17 00:00:00 2001 From: Florian Gilcher Date: Thu, 15 Aug 2019 10:29:55 +0200 Subject: [PATCH] Name threads after what they do --- examples/integrate-thread.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/integrate-thread.rs b/examples/integrate-thread.rs index 3465e5d..12a8aff 100644 --- a/examples/integrate-thread.rs +++ b/examples/integrate-thread.rs @@ -44,28 +44,28 @@ where } fn main() { - let thread_handle = spawn(move || { + let sleepy_thread = spawn(move || { thread::sleep(time::Duration::from_millis(1000)); String::from("Finished") }); task::block_on(async move { - println!("waiting for thread 1"); - let thread_result = thread_handle.join().await; + println!("waiting for sleepy thread"); + let thread_result = sleepy_thread.join().await; match thread_result { Ok(s) => println!("Result: {}", s), Err(e) => println!("Error: {:?}", e), } }); - let thread_handle = spawn(move || { + let panicing_thread = spawn(move || { panic!("aaah!"); String::from("Finished!") }); task::block_on(async move { - println!("waiting for thread 2"); - let thread_result = thread_handle.join().await; + println!("waiting for panicing thread"); + let thread_result = panicing_thread.join().await; match thread_result { Ok(s) => println!("Result: {}", s), Err(e) => println!("Error: {:?}", e),