SHARE
TWEET

Untitled

a guest Jul 20th, 2019 69 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top