Skip to content

Commit cd041c0

Browse files
committed
---
yaml --- r: 23542 b: refs/heads/master c: 161a82e h: refs/heads/master v: v3
1 parent c395846 commit cd041c0

File tree

114 files changed

+531
-546
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+531
-546
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: 4ba9fdd3627869f04ee39d6146023df822e0936e
2+
refs/heads/master: 161a82e433fbfbc0bd57a4d951ac37656a8a30f6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/doc/rust.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,8 +3030,8 @@ The result of a `spawn` call is a `core::task::task` value.
30303030
An example of a `spawn` call:
30313031

30323032
~~~~
3033-
let po = comm::port();
3034-
let ch = comm::chan(po);
3033+
let po = comm::Port();
3034+
let ch = comm::Chan(po);
30353035
30363036
do task::spawn {
30373037
// let task run, do other things
@@ -3052,24 +3052,24 @@ channel's outgoing buffer.
30523052
An example of a send:
30533053

30543054
~~~~
3055-
let po = comm::port();
3056-
let ch = comm::chan(po);
3055+
let po = comm::Port();
3056+
let ch = comm::Chan(po);
30573057
comm::send(ch, ~"hello, world");
30583058
~~~~
30593059

30603060

30613061
### Receiving values from ports
30623062

30633063
Receiving a value is done by a call to the `recv` method on a value of type
3064-
`core::comm::port`. This call causes the receiving task to enter the *blocked
3064+
`core::comm::Port`. This call causes the receiving task to enter the *blocked
30653065
reading* state until a value arrives in the port's receive queue, at which
30663066
time the port deques a value to return, and un-blocks the receiving task.
30673067

30683068
An example of a *receive*:
30693069

30703070
~~~~~~~~
3071-
# let po = comm::port();
3072-
# let ch = comm::chan(po);
3071+
# let po = comm::Port();
3072+
# let ch = comm::Chan(po);
30733073
# comm::send(ch, ~"");
30743074
let s = comm::recv(po);
30753075
~~~~~~~~

trunk/doc/tutorial.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2996,9 +2996,9 @@ message to the port. The next statement actually spawns the child:
29962996

29972997
~~~~
29982998
# import task::{spawn};
2999-
# import comm::{port, chan};
2999+
# import comm::{Port, Chan};
30003000
# fn some_expensive_computation() -> int { 42 }
3001-
# let port = port();
3001+
# let port = Port();
30023002
# let chan = port.chan();
30033003
do spawn {
30043004
let result = some_expensive_computation();

trunk/src/libcore/comm.rs

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
import either::Either;
3131
import libc::size_t;
3232

33-
export Port, port;
34-
export Chan, chan;
33+
export Port;
34+
export Chan;
3535
export send;
3636
export recv;
3737
export peek;
@@ -69,13 +69,13 @@ enum Chan<T: send> {
6969
}
7070

7171
/// Constructs a port
72-
fn port<T: send>() -> Port<T> {
72+
fn Port<T: send>() -> Port<T> {
7373
Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
7474
}
7575

7676
impl<T: send> Port<T> {
7777

78-
fn chan() -> Chan<T> { chan(self) }
78+
fn chan() -> Chan<T> { Chan(self) }
7979
fn send(+v: T) { self.chan().send(v) }
8080
fn recv() -> T { recv(self) }
8181
fn peek() -> bool { peek(self) }
@@ -93,7 +93,7 @@ impl<T: send> Chan<T> {
9393

9494
/// Open a new receiving channel for the duration of a function
9595
fn listen<T: send, U>(f: fn(Chan<T>) -> U) -> U {
96-
let po = port();
96+
let po = Port();
9797
f(po.chan())
9898
}
9999

@@ -157,7 +157,7 @@ fn as_raw_port<T: send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
157157
* Constructs a channel. The channel is bound to the port used to
158158
* construct it.
159159
*/
160-
fn chan<T: send>(p: Port<T>) -> Chan<T> {
160+
fn Chan<T: send>(p: Port<T>) -> Chan<T> {
161161
Chan_(rustrt::get_port_id((**p).po))
162162
}
163163

@@ -295,51 +295,51 @@ extern mod rusti {
295295

296296

297297
#[test]
298-
fn create_port_and_chan() { let p = port::<int>(); chan(p); }
298+
fn create_port_and_chan() { let p = Port::<int>(); Chan(p); }
299299

300300
#[test]
301301
fn send_int() {
302-
let p = port::<int>();
303-
let c = chan(p);
302+
let p = Port::<int>();
303+
let c = Chan(p);
304304
send(c, 22);
305305
}
306306

307307
#[test]
308308
fn send_recv_fn() {
309-
let p = port::<int>();
310-
let c = chan::<int>(p);
309+
let p = Port::<int>();
310+
let c = Chan::<int>(p);
311311
send(c, 42);
312312
assert (recv(p) == 42);
313313
}
314314

315315
#[test]
316316
fn send_recv_fn_infer() {
317-
let p = port();
318-
let c = chan(p);
317+
let p = Port();
318+
let c = Chan(p);
319319
send(c, 42);
320320
assert (recv(p) == 42);
321321
}
322322

323323
#[test]
324324
fn chan_chan_infer() {
325-
let p = port(), p2 = port::<int>();
326-
let c = chan(p);
327-
send(c, chan(p2));
325+
let p = Port(), p2 = Port::<int>();
326+
let c = Chan(p);
327+
send(c, Chan(p2));
328328
recv(p);
329329
}
330330

331331
#[test]
332332
fn chan_chan() {
333-
let p = port::<Chan<int>>(), p2 = port::<int>();
334-
let c = chan(p);
335-
send(c, chan(p2));
333+
let p = Port::<Chan<int>>(), p2 = Port::<int>();
334+
let c = Chan(p);
335+
send(c, Chan(p2));
336336
recv(p);
337337
}
338338

339339
#[test]
340340
fn test_peek() {
341-
let po = port();
342-
let ch = chan(po);
341+
let po = Port();
342+
let ch = Chan(po);
343343
assert !peek(po);
344344
send(ch, ());
345345
assert peek(po);
@@ -349,10 +349,10 @@ fn test_peek() {
349349

350350
#[test]
351351
fn test_select2_available() {
352-
let po_a = port();
353-
let po_b = port();
354-
let ch_a = chan(po_a);
355-
let ch_b = chan(po_b);
352+
let po_a = Port();
353+
let po_b = Port();
354+
let ch_a = Chan(po_a);
355+
let ch_b = Chan(po_b);
356356

357357
send(ch_a, ~"a");
358358

@@ -365,10 +365,10 @@ fn test_select2_available() {
365365
366366
#[test]
367367
fn test_select2_rendezvous() {
368-
let po_a = port();
369-
let po_b = port();
370-
let ch_a = chan(po_a);
371-
let ch_b = chan(po_b);
368+
let po_a = Port();
369+
let po_b = Port();
370+
let ch_a = Chan(po_a);
371+
let ch_b = Chan(po_b);
372372
373373
for iter::repeat(10u) {
374374
do task::spawn {
@@ -389,10 +389,10 @@ fn test_select2_rendezvous() {
389389
390390
#[test]
391391
fn test_select2_stress() {
392-
let po_a = port();
393-
let po_b = port();
394-
let ch_a = chan(po_a);
395-
let ch_b = chan(po_b);
392+
let po_a = Port();
393+
let po_b = Port();
394+
let ch_a = Chan(po_a);
395+
let ch_b = Chan(po_b);
396396
397397
let msgs = 100u;
398398
let times = 4u;
@@ -426,8 +426,8 @@ fn test_select2_stress() {
426426

427427
#[test]
428428
fn test_recv_chan() {
429-
let po = port();
430-
let ch = chan(po);
429+
let po = Port();
430+
let ch = Chan(po);
431431
send(ch, ~"flower");
432432
assert recv_chan(ch) == ~"flower";
433433
}
@@ -436,16 +436,16 @@ fn test_recv_chan() {
436436
#[should_fail]
437437
#[ignore(cfg(windows))]
438438
fn test_recv_chan_dead() {
439-
let ch = chan(port());
439+
let ch = Chan(Port());
440440
send(ch, ~"flower");
441441
recv_chan(ch);
442442
}
443443

444444
#[test]
445445
#[ignore(cfg(windows))]
446446
fn test_recv_chan_wrong_task() {
447-
let po = port();
448-
let ch = chan(po);
447+
let po = Port();
448+
let ch = Chan(po);
449449
send(ch, ~"flower");
450450
assert result::is_err(task::try(||
451451
recv_chan(ch)
@@ -454,14 +454,14 @@ fn test_recv_chan_wrong_task() {
454454

455455
#[test]
456456
fn test_port_send() {
457-
let po = port();
457+
let po = Port();
458458
po.send(());
459459
po.recv();
460460
}
461461

462462
#[test]
463463
fn test_chan_peek() {
464-
let po = port();
464+
let po = Port();
465465
let ch = po.chan();
466466
ch.send(());
467467
assert ch.peek();
@@ -482,7 +482,7 @@ fn test_listen() {
482482
fn test_port_detach_fail() {
483483
for iter::repeat(100u) {
484484
do task::spawn_unlinked {
485-
let po = port();
485+
let po = Port();
486486
let ch = po.chan();
487487

488488
do task::spawn {

0 commit comments

Comments
 (0)