Skip to content

Commit 411247d

Browse files
committed
---
yaml --- r: 22755 b: refs/heads/master c: 531ea69 h: refs/heads/master i: 22753: 04e8610 22751: c31198a v: v3
1 parent 9ad1b07 commit 411247d

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 2d15b6ef424016765c659305a4265813d2b498d0
2+
refs/heads/master: 531ea695f64e8d7105f904c515a6ff84fa32dc77
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/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() {

trunk/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)