Add first version of part 14
[rust-101.git] / src / part12.rs
index 8a14defd27a2f53f47239e4e81f44d6d76d3fe52..dc0da61df5ae952c90fc243128e825e32537f1ea 100644 (file)
@@ -1,5 +1,5 @@
-// Rust-101, Part 12: Concurrency, Send
-// ====================================
+// Rust-101, Part 12: Concurrency, Arc, Send
+// =========================================
 
 use std::io::prelude::*;
 use std::{io, fs, thread};
@@ -124,6 +124,9 @@ pub fn run(options: Options) {
     let handle3 = thread::spawn(move || output_lines(options3, filtered_receiver));
 
     // Finally, wait until all three threads did their job.
+    //@ Joining a thread waits for its termination. This can fail if that thread panicked: In this case, we could get
+    //@ access to the data that it provided to `panic!`. Here, we just assert that they did not panic - so we will panic ourselves
+    //@ if that happened.
     handle1.join().unwrap();
     handle2.join().unwrap();
     handle3.join().unwrap();