Skip to content

Commit 7e5b86d

Browse files
committed
---
yaml --- r: 28596 b: refs/heads/try c: 3cb0fcb h: refs/heads/master v: v3
1 parent 496ad20 commit 7e5b86d

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 0c82c00dc4f49aeb9b57c92c9a40ae35d8a1ee29
5+
refs/heads/try: 3cb0fcb803602994c374bbc556a40da4bc5199ac
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/src/libcore/comm.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,6 @@
3030
use either::Either;
3131
use libc::size_t;
3232

33-
export Port;
34-
export Chan;
35-
export send;
36-
export recv;
37-
export peek;
38-
export recv_chan;
39-
export select2;
40-
export methods;
41-
export listen;
4233

4334

4435
/**
@@ -48,7 +39,7 @@ export listen;
4839
* transmitted. If a port value is copied, both copies refer to the same
4940
* port. Ports may be associated with multiple `chan`s.
5041
*/
51-
enum Port<T: Send> {
42+
pub enum Port<T: Send> {
5243
Port_(@PortPtr<T>)
5344
}
5445

@@ -64,12 +55,12 @@ enum Port<T: Send> {
6455
* data will be silently dropped. Channels may be duplicated and
6556
* themselves transmitted over other channels.
6657
*/
67-
enum Chan<T: Send> {
58+
pub enum Chan<T: Send> {
6859
Chan_(port_id)
6960
}
7061

7162
/// Constructs a port
72-
fn Port<T: Send>() -> Port<T> {
63+
pub fn Port<T: Send>() -> Port<T> {
7364
Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
7465
}
7566

@@ -92,7 +83,7 @@ impl<T: Send> Chan<T> {
9283
}
9384

9485
/// Open a new receiving channel for the duration of a function
95-
fn listen<T: Send, U>(f: fn(Chan<T>) -> U) -> U {
86+
pub fn listen<T: Send, U>(f: fn(Chan<T>) -> U) -> U {
9687
let po = Port();
9788
f(po.chan())
9889
}
@@ -167,15 +158,15 @@ fn as_raw_port<T: Send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
167158
* Constructs a channel. The channel is bound to the port used to
168159
* construct it.
169160
*/
170-
fn Chan<T: Send>(p: Port<T>) -> Chan<T> {
161+
pub fn Chan<T: Send>(p: Port<T>) -> Chan<T> {
171162
Chan_(rustrt::get_port_id((**p).po))
172163
}
173164

174165
/**
175166
* Sends data over a channel. The sent data is moved into the channel,
176167
* whereupon the caller loses access to it.
177168
*/
178-
fn send<T: Send>(ch: Chan<T>, +data: T) {
169+
pub fn send<T: Send>(ch: Chan<T>, +data: T) {
179170
let Chan_(p) = ch;
180171
let data_ptr = ptr::addr_of(data) as *();
181172
let res = rustrt::rust_port_id_send(p, data_ptr);
@@ -190,13 +181,13 @@ fn send<T: Send>(ch: Chan<T>, +data: T) {
190181
* Receive from a port. If no data is available on the port then the
191182
* task will block until data becomes available.
192183
*/
193-
fn recv<T: Send>(p: Port<T>) -> T { recv_((**p).po) }
184+
pub fn recv<T: Send>(p: Port<T>) -> T { recv_((**p).po) }
194185

195186
/// Returns true if there are messages available
196-
fn peek<T: Send>(p: Port<T>) -> bool { peek_((**p).po) }
187+
pub fn peek<T: Send>(p: Port<T>) -> bool { peek_((**p).po) }
197188

198189
#[doc(hidden)]
199-
fn recv_chan<T: Send>(ch: comm::Chan<T>) -> T {
190+
pub fn recv_chan<T: Send>(ch: comm::Chan<T>) -> T {
200191
as_raw_port(ch, |x|recv_(x))
201192
}
202193

@@ -231,7 +222,7 @@ fn peek_(p: *rust_port) -> bool {
231222
}
232223

233224
/// Receive on one of two ports
234-
fn select2<A: Send, B: Send>(p_a: Port<A>, p_b: Port<B>)
225+
pub fn select2<A: Send, B: Send>(p_a: Port<A>, p_b: Port<B>)
235226
-> Either<A, B> {
236227
let ports = ~[(**p_a).po, (**p_b).po];
237228
let yield = 0, yieldp = ptr::addr_of(yield);

0 commit comments

Comments
 (0)