mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
16 lines
291 B
Rust
16 lines
291 B
Rust
//@ run-pass
|
|
//@ ignore-emscripten no threads support
|
|
|
|
use std::sync::mpsc::channel;
|
|
use std::thread;
|
|
|
|
pub fn main() {
|
|
let (tx, rx) = channel();
|
|
|
|
tx.send("hello, world").unwrap();
|
|
|
|
thread::spawn(move|| {
|
|
println!("{}", rx.recv().unwrap());
|
|
}).join().ok().unwrap();
|
|
}
|