]> git.lizzy.rs Git - rust.git/blob - src/test/ui/threads-sendsync/spawn-types.rs
Merge commit 'e18101137866b79045fee0ef996e696e68c920b4' into clippyup
[rust.git] / src / test / ui / threads-sendsync / spawn-types.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3
4 // ignore-emscripten no threads support
5
6 /*
7   Make sure we can spawn tasks that take different types of
8   parameters. This is based on a test case for #520 provided by Rob
9   Arnold.
10  */
11
12 use std::thread;
13 use std::sync::mpsc::{channel, Sender};
14
15 type ctx = Sender<isize>;
16
17 fn iotask(_tx: &ctx, ip: String) {
18     assert_eq!(ip, "localhost".to_string());
19 }
20
21 pub fn main() {
22     let (tx, _rx) = channel::<isize>();
23     let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) );
24     t.join().ok().unwrap();
25 }