title: How can I cause a panic on a thread to immediately end the main thread?
body: <p>In Rust, a panic terminates the current thread but is not sent back to the main thread. The solution we are told is to use <code>join</code>. However, this blocks the currently executing thread. So if my main thread spawns 2 threads, I cannot join both of them and immediately get a panic back.</p>
  
  <pre><code>let jh1 = thread::spawn(|| { println!("thread 1"); sleep(1000000); };
  let jh2 = thread::spawn(|| { panic!("thread 2") };
  </code></pre>
  
  <p>In the above, if I join on thread 1 and then on thread 2 I will be waiting for 1 before ever receiving a panic from either thread</p>
  
  <p>Although in some cases I desire the current behavior, my goal is to default to Go's behavior where I can spawn a thread and have it panic on that thread and then immediately end the main thread. (The Go specification also documents a <code>protect</code> function, so it is easy to achieve Rust behavior in Go).</p>