Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::sync::mpsc::channel;
- use std::thread;
- fn main() {
- let (tx, rx) = channel();
- let jh = thread::spawn(move || {
- let msg = rx.recv().unwrap();
- println!("Hello, {}!", msg);
- });
- tx.send("world").unwrap();
- jh.join().unwrap();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement