De-mode comm::Chan

This commit is contained in:
Tim Chevalier 2012-10-03 14:38:01 -07:00
parent 777baeb298
commit fe12da0864
63 changed files with 173 additions and 173 deletions

View file

@ -35,7 +35,7 @@ fn main() {
let msg_per_task = uint::from_str(args[2]).get();
let num_port = Port();
let mut num_chan = Chan(num_port);
let mut num_chan = Chan(&num_port);
let start = time::precise_time_s();
@ -44,12 +44,12 @@ fn main() {
for uint::range(1u, num_tasks) |i| {
let get_chan = Port();
let get_chan_chan = Chan(get_chan);
let get_chan_chan = Chan(&get_chan);
let new_future = do future::spawn
|copy num_chan, move get_chan_chan| {
let p = Port();
get_chan_chan.send(Chan(p));
get_chan_chan.send(Chan(&p));
thread_ring(i, msg_per_task, num_chan, p)
};
futures.push(new_future);

View file

@ -126,8 +126,8 @@ fn rendezvous(nn: uint, set: ~[color]) {
let from_creatures_log: comm::Port<~str> = comm::Port();
// these channels will be passed to the creatures so they can talk to us
let to_rendezvous = comm::Chan(from_creatures);
let to_rendezvous_log = comm::Chan(from_creatures_log);
let to_rendezvous = comm::Chan(&from_creatures);
let to_rendezvous_log = comm::Chan(&from_creatures_log);
// these channels will allow us to talk to each creature by 'name'/index
let to_creature: ~[comm::Chan<Option<creature_info>>] =

View file

@ -142,7 +142,7 @@ fn main() {
// initialize each sequence sorter
let sizes = ~[1u,2u,3u,4u,6u,12u,18u];
let from_child = vec::map (sizes, |_sz| comm::Port() );
let to_parent = vec::mapi(sizes, |ii, _sz| comm::Chan(from_child[ii]) );
let to_parent = vec::mapi(sizes, |ii, _sz| comm::Chan(&from_child[ii]) );
let to_child = vec::mapi(sizes, |ii, sz| {
let ii = ii;
let sz = *sz;

View file

@ -103,7 +103,7 @@ impl devnull: io::Writer {
fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
{
let p: comm::Port<line> = comm::Port();
let ch = comm::Chan(p);
let ch = comm::Chan(&p);
comm::send(writech, ch);
let cout: io::Writer = match path {
~"" => {
@ -169,7 +169,7 @@ fn main() {
else { uint::from_str(args[1]).get() };
let writep = comm::Port();
let writech = comm::Chan(writep);
let writech = comm::Chan(&writep);
do task::spawn {
writer(path, writech, size);
};

View file

@ -7,7 +7,7 @@ fn start(+token: int) {
use iter::*;
let p = comm::Port();
let mut ch = comm::Chan(p);
let mut ch = comm::Chan(&p);
for int::range(2, n_threads + 1) |i| {
let id = n_threads + 2 - i;
let to_child = do task::spawn_listener::<int> |p, copy ch| {

View file

@ -11,7 +11,7 @@
// Doesn't return until all such tasks are ready, but doesn't block forever itself.
fn grandchild_group(num_tasks: uint) {
let po = comm::Port();
let ch = comm::Chan(po);
let ch = comm::Chan(&po);
for num_tasks.times {
do task::spawn { // linked

View file

@ -8,7 +8,7 @@ enum msg {
fn calc(children: uint, parent_ch: comm::Chan<msg>) {
let port = comm::Port();
let chan = comm::Chan(port);
let chan = comm::Chan(&port);
let mut child_chs = ~[];
let mut sum = 0;
@ -60,7 +60,7 @@ fn main() {
let children = uint::from_str(args[1]).get();
let port = comm::Port();
let chan = comm::Chan(port);
let chan = comm::Chan(&port);
do task::spawn {
calc(children, chan);
};

View file

@ -43,7 +43,7 @@ trait word_reader {
type joinable_task = Port<()>;
fn spawn_joinable(+f: fn~()) -> joinable_task {
let p = Port();
let c = Chan(p);
let c = Chan(&p);
do task::spawn() |move f| {
f();
c.send(());
@ -206,7 +206,7 @@ mod map_reduce {
{
let p = Port();
send(out, Chan(p));
send(out, Chan(&p));
let mut ref_count = 0;
let mut is_done = false;
@ -268,7 +268,7 @@ mod map_reduce {
None => {
// log(error, "creating new reducer for " + k);
let p = Port();
let ch = Chan(p);
let ch = Chan(&p);
let r = reduce, kk = k;
tasks.push(spawn_joinable(|| reduce_task(r, kk, ch) ));
c = recv(p);