Skip to content

Commit 5bae4b4

Browse files
committed
---
yaml --- r: 20647 b: refs/heads/snap-stage3 c: 531ea69 h: refs/heads/master i: 20645: a544ac2 20643: 88f6eaa 20639: b5e2f7e v: v3
1 parent 38d9462 commit 5bae4b4

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,7 +1,7 @@
11
---
22
refs/heads/master: e430a699f2c60890d9b86069fd0c68a70ece7120
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 2d15b6ef424016765c659305a4265813d2b498d0
4+
refs/heads/snap-stage3: 531ea695f64e8d7105f904c515a6ff84fa32dc77
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/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/snap-stage3/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)