mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
17 lines
334 B
Rust
17 lines
334 B
Rust
//@ run-pass
|
|
//@ ignore-emscripten no threads support
|
|
|
|
use std::sync::mpsc::channel;
|
|
use std::thread;
|
|
|
|
pub fn main() {
|
|
let (tx, rx) = channel::<&'static str>();
|
|
|
|
let t = thread::spawn(move|| {
|
|
assert_eq!(rx.recv().unwrap(), "hello, world");
|
|
});
|
|
|
|
tx.send("hello, world").unwrap();
|
|
t.join().ok().unwrap();
|
|
}
|