Skip to content

Commit

Permalink
core: Extract comm from pipes. rust-lang#4742
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Feb 22, 2013
1 parent ab784b7 commit dab6a85
Show file tree
Hide file tree
Showing 89 changed files with 683 additions and 611 deletions.
20 changes: 10 additions & 10 deletions doc/tutorial-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ concurrently:

~~~~
use task::spawn;
use pipes::{stream, Port, Chan};
use comm::{stream, Port, Chan};
let (port, chan): (Port<int>, Chan<int>) = stream();
Expand All @@ -178,7 +178,7 @@ stream for sending and receiving integers (the left-hand side of the `let`,
a tuple into its component parts).

~~~~
# use pipes::{stream, Chan, Port};
# use comm::{stream, Chan, Port};
let (port, chan): (Port<int>, Chan<int>) = stream();
~~~~

Expand All @@ -189,7 +189,7 @@ spawns the child task.
~~~~
# use task::{spawn};
# use task::spawn;
# use pipes::{stream, Port, Chan};
# use comm::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
# let (port, chan) = stream();
do spawn || {
Expand All @@ -209,7 +209,7 @@ computation, then waits for the child's result to arrive on the
port:

~~~~
# use pipes::{stream, Port, Chan};
# use comm::{stream, Port, Chan};
# fn some_other_expensive_computation() {}
# let (port, chan) = stream::<int>();
# chan.send(0);
Expand All @@ -225,7 +225,7 @@ following program is ill-typed:

~~~ {.xfail-test}
# use task::{spawn};
# use pipes::{stream, Port, Chan};
# use comm::{stream, Port, Chan};
# fn some_expensive_computation() -> int { 42 }
let (port, chan) = stream();
Expand All @@ -245,7 +245,7 @@ Instead we can use a `SharedChan`, a type that allows a single

~~~
# use task::spawn;
use pipes::{stream, SharedChan};
use comm::{stream, SharedChan};
let (port, chan) = stream();
let chan = SharedChan(chan);
Expand Down Expand Up @@ -278,7 +278,7 @@ might look like the example below.

~~~
# use task::spawn;
# use pipes::{stream, Port, Chan};
# use comm::{stream, Port, Chan};
// Create a vector of ports, one for each child task
let ports = do vec::from_fn(3) |init_val| {
Expand Down Expand Up @@ -393,7 +393,7 @@ internally, with additional logic to wait for the child task to finish
before returning. Hence:

~~~
# use pipes::{stream, Chan, Port};
# use comm::{stream, Chan, Port};
# use task::{spawn, try};
# fn sleep_forever() { loop { task::yield() } }
# do task::try {
Expand Down Expand Up @@ -468,7 +468,7 @@ Here is the function that implements the child task:

~~~~
# use std::comm::DuplexStream;
# use pipes::{Port, Chan};
# use comm::{Port, Chan};
fn stringifier(channel: &DuplexStream<~str, uint>) {
let mut value: uint;
loop {
Expand All @@ -491,7 +491,7 @@ Here is the code for the parent task:

~~~~
# use std::comm::DuplexStream;
# use pipes::{Port, Chan};
# use comm::{Port, Chan};
# use task::spawn;
# fn stringifier(channel: &DuplexStream<~str, uint>) {
# let mut value: uint;
Expand Down
2 changes: 1 addition & 1 deletion src/compiletest/procsrv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub fn run(lib_path: ~str,


writeclose(pipe_in.out, input);
let p = pipes::PortSet();
let p = comm::PortSet();
let ch = p.chan();
do task::spawn_sched(task::SingleThreaded) || {
let errput = readclose(pipe_err.in);
Expand Down
Loading

1 comment on commit dab6a85

@pcwalton
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r+

Please sign in to comment.