2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2016-02-11 12:34:41 +01:00
|
|
|
// ignore-emscripten no threads support
|
|
|
|
|
|
2014-12-23 11:53:35 -08:00
|
|
|
use std::sync::mpsc::channel;
|
2015-02-17 15:24:34 -08:00
|
|
|
use std::thread;
|
2014-01-09 21:06:55 +11:00
|
|
|
|
2013-09-25 00:43:37 -07:00
|
|
|
pub fn main() {
|
2014-03-09 14:58:32 -07:00
|
|
|
let (tx, rx) = channel();
|
2013-06-27 16:53:40 -07:00
|
|
|
|
2014-12-23 11:53:35 -08:00
|
|
|
tx.send("hello, world").unwrap();
|
2014-06-03 15:38:00 -04:00
|
|
|
|
2015-02-17 15:24:34 -08:00
|
|
|
thread::spawn(move|| {
|
2015-04-10 11:12:43 -07:00
|
|
|
println!("{}", rx.recv().unwrap());
|
2014-12-22 09:04:23 -08:00
|
|
|
}).join().ok().unwrap();
|
2013-06-27 16:53:40 -07:00
|
|
|
}
|