File tree Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Expand file tree Collapse file tree 4 files changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9
9
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10
- refs/heads/dist-snap: 6bdda1e0de6097c1647ac49da8b24e86dd5299b8
10
+ refs/heads/dist-snap: 27129c6aba153299100887de5c8643cbe3e9b8ef
11
11
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
12
12
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ struct Future<A> {
37
37
}
38
38
39
39
priv enum FutureState < A > {
40
- Pending ( fn @ ( ) -> A ) ,
40
+ Pending ( fn ~ ( ) -> A ) ,
41
41
Evaluating ,
42
42
Forced ( A )
43
43
}
@@ -93,7 +93,7 @@ fn from_port<A:Send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
93
93
}
94
94
}
95
95
96
- fn from_fn < A > ( +f : @ fn ( ) -> A ) -> Future < A > {
96
+ fn from_fn < A > ( +f : ~ fn ( ) -> A ) -> Future < A > {
97
97
/*!
98
98
* Create a future from a function.
99
99
*
@@ -239,4 +239,14 @@ mod test {
239
239
let f = spawn ( || fail) ;
240
240
let _x: ~str = get ( & f) ;
241
241
}
242
- }
242
+
243
+ #[ test]
244
+ fn test_sendable_future ( ) {
245
+ let expected = ~"schlorf";
246
+ let f = do spawn |copy expected| { expected } ;
247
+ do task:: spawn {
248
+ let actual = get( & f) ;
249
+ assert actual == expected;
250
+ }
251
+ }
252
+ }
Original file line number Diff line number Diff line change @@ -1754,7 +1754,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails
1754
1754
opts. supervised = true;
1755
1755
move opts
1756
1756
} ;
1757
-
1757
+
1758
1758
let b0 = task( ) ;
1759
1759
let b1 = TaskBuilder ( {
1760
1760
opts: move opts,
Original file line number Diff line number Diff line change @@ -285,15 +285,14 @@ fn future_writer_factory(
285
285
}
286
286
287
287
fn future_writer() -> (writer, future::Future<~str>) {
288
- let port = comm::Port();
289
- let chan = comm::Chan(port);
288
+ let (chan, port) = pipes::stream();
290
289
let writer = fn~(+instr: writeinstr) {
291
- comm:: send(chan, copy instr);
290
+ chan. send(copy instr);
292
291
};
293
292
let future = do future::from_fn {
294
293
let mut res = ~" " ;
295
294
loop {
296
- match comm :: recv( port ) {
295
+ match port . recv( ) {
297
296
write( s) => res += s,
298
297
done => break
299
298
}
You can’t perform that action at this time.
0 commit comments