Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. use std::sync::mpsc::channel;
  2. use std::thread;
  3.  
  4. fn main() {
  5. let (tx, rx) = channel();
  6. let jh = thread::spawn(move || {
  7. let msg = rx.recv().unwrap();
  8. println!("Hello, {}!", msg);
  9. });
  10. tx.send("world").unwrap();
  11. jh.join().unwrap();
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement