PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/src/test/run-pass/spawn-types.rs

http://github.com/jruderman/rust
Rust | 23 lines | 13 code | 5 blank | 5 comment | 1 complexity | 793f9bfdb4c6a07c8af1b93b074283dc MD5 | raw file
 1/*
 2  Make sure we can spawn tasks that take different types of
 3  parameters. This is based on a test case for #520 provided by Rob
 4  Arnold.
 5 */
 6
 7use std;
 8
 9import str;
10import comm;
11import task;
12
13type ctx = comm::chan<int>;
14
15fn iotask(cx: ctx, ip: ~str) {
16    assert (ip == ~"localhost");
17}
18
19fn main() {
20    let p = comm::port::<int>();
21    let ch = comm::chan(p);
22    task::spawn(|| iotask(ch, ~"localhost") );
23}