Skip to content

Commit 6a9ae6b

Browse files
committed
---
yaml --- r: 31417 b: refs/heads/dist-snap c: 531ea69 h: refs/heads/master i: 31415: 49c7add v: v3
1 parent 8d1b0e0 commit 6a9ae6b

File tree

3 files changed

+3
-66
lines changed

3 files changed

+3
-66
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 2d15b6ef424016765c659305a4265813d2b498d0
10+
refs/heads/dist-snap: 531ea695f64e8d7105f904c515a6ff84fa32dc77
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/arc.rs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
* share immutable data between tasks.
44
*/
55

6-
import comm::{port, chan, methods};
76
import sys::methods;
87

9-
export arc, get, clone, shared_arc, get_arc;
8+
export arc, get, clone;
109

1110
export exclusive, methods;
1211

@@ -122,49 +121,6 @@ impl methods<T: send> for exclusive<T> {
122121
}
123122
}
124123

125-
// Convenience code for sharing arcs between tasks
126-
127-
type get_chan<T: const send> = chan<chan<arc<T>>>;
128-
129-
// (terminate, get)
130-
type shared_arc<T: const send> = (shared_arc_res, get_chan<T>);
131-
132-
class shared_arc_res {
133-
let c: comm::chan<()>;
134-
new(c: comm::chan<()>) { self.c = c; }
135-
drop { self.c.send(()); }
136-
}
137-
138-
fn shared_arc<T: send const>(-data: T) -> shared_arc<T> {
139-
let a = arc::arc(data);
140-
let p = port();
141-
let c = chan(p);
142-
do task::spawn() |move a| {
143-
let mut live = true;
144-
let terminate = port();
145-
let get = port();
146-
147-
c.send((chan(terminate), chan(get)));
148-
149-
while live {
150-
alt comm::select2(terminate, get) {
151-
either::left(()) { live = false; }
152-
either::right(cc) {
153-
comm::send(cc, arc::clone(&a));
154-
}
155-
}
156-
}
157-
};
158-
let (terminate, get) = p.recv();
159-
(shared_arc_res(terminate), get)
160-
}
161-
162-
fn get_arc<T: send const>(c: get_chan<T>) -> arc::arc<T> {
163-
let p = port();
164-
c.send(chan(p));
165-
p.recv()
166-
}
167-
168124
#[cfg(test)]
169125
mod tests {
170126
import comm::*;
@@ -196,25 +152,6 @@ mod tests {
196152
log(info, arc_v);
197153
}
198154

199-
#[test]
200-
fn auto_share_arc() {
201-
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
202-
let (_res, arc_c) = shared_arc(v);
203-
204-
let p = port();
205-
let c = chan(p);
206-
207-
do task::spawn() {
208-
let arc_v = get_arc(arc_c);
209-
let v = *get(&arc_v);
210-
assert v[2] == 3;
211-
212-
c.send(());
213-
};
214-
215-
assert p.recv() == ();
216-
}
217-
218155
#[test]
219156
#[ignore] // this can probably infinite loop too.
220157
fn exclusive_arc() {

branches/dist-snap/src/test/run-pass/trivial-message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pipes::{port, chan}
1+
import pipes::{port, chan};
22

33
/*
44
This is about the simplest program that can successfully send a

0 commit comments

Comments
 (0)