Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created March 21, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexcrichton/56300b87af6fa554e52d to your computer and use it in GitHub Desktop.
Save alexcrichton/56300b87af6fa554e52d to your computer and use it in GitHub Desktop.
use std::thread;
use std::rt;
use std::sync::mpsc::channel;
fn main() {
let (tx1, rx1) = channel();
let (tx2, rx2) = channel();
rt::at_exit(move || {
tx1.send(());
rx2.recv();
});
thread::spawn(move || {
rx1.recv();
println!("hello!");
tx2.send(());
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment