We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68512f2 commit 27972a6Copy full SHA for 27972a6
src/test/run-pass/unique-send-2.rs
@@ -0,0 +1,27 @@
1
+use std;
2
+import std::comm;
3
+import std::task;
4
+import std::uint;
5
+
6
+fn child(c: comm::chan<~uint>, i: uint) {
7
+ comm::send(c, ~i);
8
+}
9
10
+fn main() {
11
+ let p = comm::port();
12
+ let n = 100u;
13
+ let expected = 0u;
14
+ for each i in uint::range(0u, n) {
15
+ let f = bind child(comm::chan(p), i);
16
+ task::spawn(f);
17
+ expected += i;
18
+ }
19
20
+ let actual = 0u;
21
22
+ let j = comm::recv(p);
23
+ actual += *j;
24
25
26
+ assert expected == actual;
27
src/test/run-pass/unique-send.rs
@@ -0,0 +1,11 @@
+ let c = comm::chan(p);
+ comm::send(c, ~100);
+ let v = comm::recv(p);
+ assert v == ~100;
0 commit comments