Skip to content

core: Extract comm from pipes. #4742 #5081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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