2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2016-02-11 12:34:41 +01:00
|
|
|
// ignore-emscripten no threads support
|
2015-03-22 13:13:15 -07:00
|
|
|
|
2014-12-23 11:53:35 -08:00
|
|
|
use std::sync::mpsc::channel;
|
2015-02-17 15:24:34 -08:00
|
|
|
use std::thread;
|
2013-05-24 19:35:29 -07:00
|
|
|
|
2013-03-27 09:58:28 -07:00
|
|
|
pub fn main() {
|
2014-03-09 14:58:32 -07:00
|
|
|
let (tx, rx) = channel::<&'static str>();
|
2013-03-04 22:33:51 -05:00
|
|
|
|
2015-02-17 15:24:34 -08:00
|
|
|
let t = thread::spawn(move|| {
|
2014-12-23 11:53:35 -08:00
|
|
|
assert_eq!(rx.recv().unwrap(), "hello, world");
|
2014-01-27 18:29:50 -05:00
|
|
|
});
|
2013-03-04 22:33:51 -05:00
|
|
|
|
2014-12-23 11:53:35 -08:00
|
|
|
tx.send("hello, world").unwrap();
|
|
|
|
t.join().ok().unwrap();
|
2013-03-04 22:33:51 -05:00
|
|
|
}
|