/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. use std;
  7. import str;
  8. import comm;
  9. import task;
  10. type ctx = comm::chan<int>;
  11. fn iotask(cx: ctx, ip: ~str) {
  12. assert (ip == ~"localhost");
  13. }
  14. fn main() {
  15. let p = comm::port::<int>();
  16. let ch = comm::chan(p);
  17. task::spawn(|| iotask(ch, ~"localhost") );
  18. }