]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/basic-1.rs
port over the tests to use the new API
[rust.git] / src / test / run-pass / basic-1.rs
1 // -*- rust -*-
2
3 use std;
4 import comm::chan;
5 import comm::port;
6 import comm::send;
7 import comm::recv;
8 import task;
9
10 fn a(c: chan<int>) { send(c, 10); }
11
12 fn main() {
13     let p = port();
14     let ch = chan(p);
15     task::spawn {|| a(ch); };
16     task::spawn {|| a(ch); };
17     let n: int = 0;
18     n = recv(p);
19     n = recv(p);
20     //    #debug("Finished.");
21 }
22
23 fn b(c: chan<int>) {
24     //    #debug("task b0");
25     //    #debug("task b1");
26     //    #debug("task b2");
27     //    #debug("task b3");
28     //    #debug("task b4");
29     //    #debug("task b5");
30     send(c, 10);
31 }