2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2024-03-06 12:19:20 -08:00
|
|
|
//@ needs-threads
|
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
|
|
|
|
2024-08-24 05:32:52 +02: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
|
|
|
}
|