core::comm: Modernize constructors to use new
This commit is contained in:
parent
bc60d84507
commit
decd3901d5
32 changed files with 80 additions and 68 deletions
|
|
@ -58,7 +58,7 @@ fn run(args: &[~str]) {
|
|||
let (from_child, to_parent) = comm::stream();
|
||||
let (from_parent, to_child) = comm::stream();
|
||||
|
||||
let to_child = SharedChan(to_child);
|
||||
let to_child = SharedChan::new(to_child);
|
||||
|
||||
let size = uint::from_str(args[1]).get();
|
||||
let workers = uint::from_str(args[2]).get();
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ fn server(requests: PortSet<request>, responses: Chan<uint>) {
|
|||
fn run(args: &[~str]) {
|
||||
let (from_child, to_parent) = stream();
|
||||
let (from_parent_, to_child) = stream();
|
||||
let from_parent = PortSet();
|
||||
let from_parent = PortSet::new();
|
||||
from_parent.add(from_parent_);
|
||||
|
||||
let size = uint::from_str(args[1]).get();
|
||||
|
|
|
|||
|
|
@ -137,9 +137,9 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
|
||||
// these ports will allow us to hear from the creatures
|
||||
let (from_creatures, to_rendezvous) = stream::<CreatureInfo>();
|
||||
let to_rendezvous = SharedChan(to_rendezvous);
|
||||
let to_rendezvous = SharedChan::new(to_rendezvous);
|
||||
let (from_creatures_log, to_rendezvous_log) = stream::<~str>();
|
||||
let to_rendezvous_log = SharedChan(to_rendezvous_log);
|
||||
let to_rendezvous_log = SharedChan::new(to_rendezvous_log);
|
||||
|
||||
// these channels will be passed to the creatures so they can talk to us
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ fn main() {
|
|||
else { uint::from_str(args[1]).get() };
|
||||
|
||||
let (pport, pchan) = comm::stream();
|
||||
let pchan = comm::SharedChan(pchan);
|
||||
let pchan = comm::SharedChan::new(pchan);
|
||||
for uint::range(0_u, size) |j| {
|
||||
let cchan = pchan.clone();
|
||||
do task::spawn { cchan.send(chanmb(j, size, depth)) };
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ fn fib(n: int) -> int {
|
|||
} else if n <= 2 {
|
||||
c.send(1);
|
||||
} else {
|
||||
let p = PortSet();
|
||||
let p = PortSet::new();
|
||||
let ch = p.chan();
|
||||
task::spawn(|| pfib(ch, n - 1) );
|
||||
let ch = p.chan();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ use core::comm::*;
|
|||
|
||||
fn grandchild_group(num_tasks: uint) {
|
||||
let (po, ch) = stream();
|
||||
let ch = SharedChan(ch);
|
||||
let ch = SharedChan::new(ch);
|
||||
|
||||
for num_tasks.times {
|
||||
let ch = ch.clone();
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ mod map_reduce {
|
|||
|
||||
pub fn map_reduce(inputs: ~[~str]) {
|
||||
let (ctrl_port, ctrl_chan) = stream();
|
||||
let ctrl_chan = SharedChan(ctrl_chan);
|
||||
let ctrl_chan = SharedChan::new(ctrl_chan);
|
||||
|
||||
// This task becomes the master control task. It spawns others
|
||||
// to do the rest.
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
// xfail-fast
|
||||
|
||||
pub fn main() {
|
||||
let po = comm::PortSet();
|
||||
let po = comm::PortSet::new();
|
||||
|
||||
// Spawn 10 tasks each sending us back one int.
|
||||
let mut i = 10;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ fn test00() {
|
|||
|
||||
debug!("Creating tasks");
|
||||
|
||||
let po = comm::PortSet();
|
||||
let po = comm::PortSet::new();
|
||||
|
||||
let mut i: int = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ pub fn main() { test00(); }
|
|||
fn test00() {
|
||||
let mut r: int = 0;
|
||||
let mut sum: int = 0;
|
||||
let p = comm::PortSet();
|
||||
let p = comm::PortSet::new();
|
||||
let c0 = p.chan();
|
||||
let c1 = p.chan();
|
||||
let c2 = p.chan();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ fn test00_start(c: comm::Chan<int>, start: int, number_of_messages: int) {
|
|||
fn test00() {
|
||||
let mut r: int = 0;
|
||||
let mut sum: int = 0;
|
||||
let p = comm::PortSet();
|
||||
let p = comm::PortSet::new();
|
||||
let number_of_messages: int = 10;
|
||||
|
||||
let c = p.chan();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ fn test00_start(c: &comm::Chan<int>, number_of_messages: int) {
|
|||
fn test00() {
|
||||
let r: int = 0;
|
||||
let mut sum: int = 0;
|
||||
let p = comm::PortSet();
|
||||
let p = comm::PortSet::new();
|
||||
let number_of_messages: int = 10;
|
||||
let ch = p.chan();
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ fn child(c: &SharedChan<~uint>, i: uint) {
|
|||
|
||||
pub fn main() {
|
||||
let (p, ch) = stream();
|
||||
let ch = SharedChan(ch);
|
||||
let ch = SharedChan::new(ch);
|
||||
let n = 100u;
|
||||
let mut expected = 0u;
|
||||
for uint::range(0u, n) |i| {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ fn f(c: SharedChan<bool>) {
|
|||
|
||||
pub fn main() {
|
||||
let (p, c) = stream();
|
||||
let c = SharedChan(c);
|
||||
let c = SharedChan::new(c);
|
||||
task::spawn_unlinked(|| f(c.clone()) );
|
||||
error!("hiiiiiiiii");
|
||||
assert!(p.recv());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue