]> git.lizzy.rs Git - rust.git/commitdiff
Rename core::comm to core::oldcomm
authorBrian Anderson <banderson@mozilla.com>
Thu, 13 Dec 2012 22:18:47 +0000 (14:18 -0800)
committerBrian Anderson <banderson@mozilla.com>
Fri, 14 Dec 2012 22:59:32 +0000 (14:59 -0800)
81 files changed:
src/libcore/comm.rs [deleted file]
src/libcore/core.rc
src/libcore/oldcomm.rs [new file with mode: 0644]
src/libcore/os.rs
src/libcore/private.rs
src/libcore/run.rs
src/libcore/task/mod.rs
src/libcore/task/spawn.rs
src/librustc/rustc.rc
src/librustdoc/astsrv.rs
src/librustdoc/markdown_pass.rs
src/librustdoc/markdown_writer.rs
src/librustdoc/page_pass.rs
src/librustdoc/util.rs
src/libstd/net_ip.rs
src/libstd/net_tcp.rs
src/libstd/test.rs
src/libstd/timer.rs
src/libstd/uv_global_loop.rs
src/libstd/uv_iotask.rs
src/libstd/uv_ll.rs
src/test/auxiliary/cci_capture_clause.rs
src/test/auxiliary/test_comm.rs
src/test/bench/graph500-bfs.rs
src/test/bench/msgsend-ring.rs
src/test/bench/shootout-chameneos-redux.rs
src/test/bench/shootout-k-nucleotide-pipes.rs
src/test/bench/shootout-mandelbrot.rs
src/test/bench/shootout-pfib.rs
src/test/bench/task-perf-linked-failure.rs
src/test/bench/task-perf-one-million.rs
src/test/bench/task-perf-word-count-generic.rs
src/test/compile-fail/no-capture-arc.rs
src/test/compile-fail/no-reuse-move-arc.rs
src/test/compile-fail/no-send-res-ports.rs
src/test/compile-fail/unsendable-class.rs
src/test/run-fail/linked-failure.rs
src/test/run-fail/linked-failure2.rs
src/test/run-fail/linked-failure3.rs
src/test/run-fail/linked-failure4.rs
src/test/run-fail/port-type.rs
src/test/run-fail/task-comm-recv-block.rs
src/test/run-pass/acyclic-unwind.rs
src/test/run-pass/auto_serialize.rs
src/test/run-pass/basic-1.rs
src/test/run-pass/basic-2.rs
src/test/run-pass/basic.rs
src/test/run-pass/capture_nil.rs
src/test/run-pass/cci_capture_clause.rs
src/test/run-pass/chan-leak.rs
src/test/run-pass/comm.rs
src/test/run-pass/decl-with-recv.rs
src/test/run-pass/hashmap-memory.rs
src/test/run-pass/issue-507.rs
src/test/run-pass/issue-687.rs
src/test/run-pass/issue-783.rs
src/test/run-pass/ivec-tag.rs
src/test/run-pass/lazychan.rs
src/test/run-pass/many.rs
src/test/run-pass/multiline-comment.rs
src/test/run-pass/rt-circular-buffer.rs
src/test/run-pass/rt-sched-1.rs
src/test/run-pass/send-iloop.rs
src/test/run-pass/send-resource.rs
src/test/run-pass/send-type-inference.rs
src/test/run-pass/sendable-class.rs
src/test/run-pass/sendfn-generic-fn.rs
src/test/run-pass/spawn-types.rs
src/test/run-pass/task-comm-chan-cleanup.rs
src/test/run-pass/task-comm-chan-cleanup2.rs
src/test/run-pass/task-comm-chan-cleanup3.rs
src/test/run-pass/task-comm-chan-cleanup4.rs
src/test/run-pass/task-comm-chan-nil.rs
src/test/run-pass/task-comm.rs
src/test/run-pass/task-compare.rs
src/test/run-pass/task-killjoin-rsrc.rs
src/test/run-pass/task-spawn-move-and-copy.rs
src/test/run-pass/unique-send-2.rs
src/test/run-pass/unique-send.rs
src/test/run-pass/unwind-resource.rs
src/test/run-pass/variant-attributes.rs

diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs
deleted file mode 100644 (file)
index 0f3c7fc..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-/*!
-
-Deprecated communication between tasks
-
-Communication between tasks is facilitated by ports (in the receiving
-task), and channels (in the sending task). Any number of channels may
-feed into a single port.  Ports and channels may only transmit values
-of unique types; that is, values that are statically guaranteed to be
-accessed by a single 'owner' at a time.  Unique types include scalars,
-vectors, strings, and records, tags, tuples and unique boxes (`~T`)
-thereof. Most notably, shared boxes (`@T`) may not be transmitted
-across channels.
-
-# Example
-
-~~~
-let po = comm::Port();
-let ch = comm::Chan(po);
-
-do task::spawn {
-    comm::send(ch, "Hello, World");
-}
-
-io::println(comm::recv(p));
-~~~
-
-# Note
-
-Use of this module is deprecated in favor of `core::pipes`. In the
-`core::comm` will likely be rewritten with pipes, at which point it
-will once again be the preferred module for intertask communication.
-
-*/
-
-// NB: transitionary, de-mode-ing.
-#[forbid(deprecated_mode)];
-#[forbid(deprecated_pattern)];
-
-use either::Either;
-use libc::size_t;
-// After snapshot, change p2::addr_of => addr_of
-
-/**
- * A communication endpoint that can receive messages
- *
- * Each port has a unique per-task identity and may not be replicated or
- * transmitted. If a port value is copied, both copies refer to the same
- * port.  Ports may be associated with multiple `chan`s.
- */
-pub enum Port<T: Owned> {
-    Port_(@PortPtr<T>)
-}
-
-// It's critical that this only have one variant, so it has a record
-// layout, and will work in the rust_task structure in task.rs.
-/**
- * A communication endpoint that can send messages
- *
- * Each channel is bound to a port when the channel is constructed, so
- * the destination port for a channel must exist before the channel
- * itself.  Channels are weak: a channel does not keep the port it is
- * bound to alive. If a channel attempts to send data to a dead port that
- * data will be silently dropped.  Channels may be duplicated and
- * themselves transmitted over other channels.
- */
-pub enum Chan<T: Owned> {
-    Chan_(port_id)
-}
-
-/// Constructs a port
-pub fn Port<T: Owned>() -> Port<T> {
-    Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
-}
-
-impl<T: Owned> Port<T> {
-
-    fn chan() -> Chan<T> { Chan(&self) }
-    fn send(v: T) { self.chan().send(move v) }
-    fn recv() -> T { recv(self) }
-    fn peek() -> bool { peek(self) }
-
-}
-
-impl<T: Owned> Chan<T> {
-
-    fn chan() -> Chan<T> { self }
-    fn send(v: T) { send(self, move v) }
-    fn recv() -> T { recv_chan(self) }
-    fn peek() -> bool { peek_chan(self) }
-
-}
-
-/// Open a new receiving channel for the duration of a function
-pub fn listen<T: Owned, U>(f: fn(Chan<T>) -> U) -> U {
-    let po = Port();
-    f(po.chan())
-}
-
-struct PortPtr<T:Owned> {
-    po: *rust_port,
-  drop unsafe {
-      do task::unkillable {
-        // Once the port is detached it's guaranteed not to receive further
-        // messages
-        let yield = 0;
-        let yieldp = ptr::addr_of(&yield);
-        rustrt::rust_port_begin_detach(self.po, yieldp);
-        if yield != 0 {
-            // Need to wait for the port to be detached
-            task::yield();
-        }
-        rustrt::rust_port_end_detach(self.po);
-
-        // Drain the port so that all the still-enqueued items get dropped
-        while rustrt::rust_port_size(self.po) > 0 as size_t {
-            recv_::<T>(self.po);
-        }
-        rustrt::del_port(self.po);
-    }
-  }
-}
-
-fn PortPtr<T: Owned>(po: *rust_port) -> PortPtr<T> {
-    PortPtr {
-        po: po
-    }
-}
-
-/**
- * Internal function for converting from a channel to a port
- *
- * # Failure
- *
- * Fails if the port is detached or dead. Fails if the port
- * is owned by a different task.
- */
-fn as_raw_port<T: Owned, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
-
-    struct PortRef {
-        p: *rust_port,
-       drop {
-         if !ptr::is_null(self.p) {
-           rustrt::rust_port_drop(self.p);
-         }
-       }
-    }
-
-    fn PortRef(p: *rust_port) -> PortRef {
-        PortRef {
-            p: p
-        }
-    }
-
-    let p = PortRef(rustrt::rust_port_take(*ch));
-
-    if ptr::is_null(p.p) {
-        fail ~"unable to locate port for channel"
-    } else if rustrt::get_task_id() != rustrt::rust_port_task(p.p) {
-        fail ~"unable to access unowned port"
-    }
-
-    f(p.p)
-}
-
-/**
- * Constructs a channel. The channel is bound to the port used to
- * construct it.
- */
-pub fn Chan<T: Owned>(p: &Port<T>) -> Chan<T> {
-    Chan_(rustrt::get_port_id((**p).po))
-}
-
-/**
- * Sends data over a channel. The sent data is moved into the channel,
- * whereupon the caller loses access to it.
- */
-pub fn send<T: Owned>(ch: Chan<T>, data: T) {
-    let Chan_(p) = ch;
-    let data_ptr = ptr::addr_of(&data) as *();
-    let res = rustrt::rust_port_id_send(p, data_ptr);
-    if res != 0 unsafe {
-        // Data sent successfully
-        cast::forget(move data);
-    }
-    task::yield();
-}
-
-/**
- * Receive from a port.  If no data is available on the port then the
- * task will block until data becomes available.
- */
-pub fn recv<T: Owned>(p: Port<T>) -> T { recv_((**p).po) }
-
-/// Returns true if there are messages available
-pub fn peek<T: Owned>(p: Port<T>) -> bool { peek_((**p).po) }
-
-#[doc(hidden)]
-pub fn recv_chan<T: Owned>(ch: comm::Chan<T>) -> T {
-    as_raw_port(ch, |x|recv_(x))
-}
-
-fn peek_chan<T: Owned>(ch: comm::Chan<T>) -> bool {
-    as_raw_port(ch, |x|peek_(x))
-}
-
-/// Receive on a raw port pointer
-fn recv_<T: Owned>(p: *rust_port) -> T {
-    let yield = 0;
-    let yieldp = ptr::addr_of(&yield);
-    let mut res;
-    res = rusti::init::<T>();
-    rustrt::port_recv(ptr::addr_of(&res) as *uint, p, yieldp);
-
-    if yield != 0 {
-        // Data isn't available yet, so res has not been initialized.
-        task::yield();
-    } else {
-        // In the absence of compiler-generated preemption points
-        // this is a good place to yield
-        task::yield();
-    }
-    move res
-}
-
-fn peek_(p: *rust_port) -> bool {
-    // Yield here before we check to see if someone sent us a message
-    // FIXME #524, if the compiler generates yields, we don't need this
-    task::yield();
-    rustrt::rust_port_size(p) != 0 as libc::size_t
-}
-
-/// Receive on one of two ports
-pub fn select2<A: Owned, B: Owned>(p_a: Port<A>, p_b: Port<B>)
-    -> Either<A, B> {
-    let ports = ~[(**p_a).po, (**p_b).po];
-    let yield = 0, yieldp = ptr::addr_of(&yield);
-
-    let mut resport: *rust_port;
-    resport = rusti::init::<*rust_port>();
-    do vec::as_imm_buf(ports) |ports, n_ports| {
-        rustrt::rust_port_select(ptr::addr_of(&resport), ports,
-                                 n_ports as size_t, yieldp);
-    }
-
-    if yield != 0 {
-        // Wait for data
-        task::yield();
-    } else {
-        // As in recv, this is a good place to yield anyway until
-        // the compiler generates yield calls
-        task::yield();
-    }
-
-    // Now we know the port we're supposed to receive from
-    assert resport != ptr::null();
-
-    if resport == (**p_a).po {
-        either::Left(recv(p_a))
-    } else if resport == (**p_b).po {
-        either::Right(recv(p_b))
-    } else {
-        fail ~"unexpected result from rust_port_select";
-    }
-}
-
-
-/* Implementation details */
-
-#[allow(non_camel_case_types)] // runtime type
-enum rust_port {}
-
-#[allow(non_camel_case_types)] // runtime type
-type port_id = int;
-
-#[abi = "cdecl"]
-extern mod rustrt {
-    fn rust_port_id_send(target_port: port_id, data: *()) -> libc::uintptr_t;
-
-    fn new_port(unit_sz: libc::size_t) -> *rust_port;
-    fn del_port(po: *rust_port);
-    fn rust_port_begin_detach(po: *rust_port,
-                              yield: *libc::uintptr_t);
-    fn rust_port_end_detach(po: *rust_port);
-    fn get_port_id(po: *rust_port) -> port_id;
-    fn rust_port_size(po: *rust_port) -> libc::size_t;
-    fn port_recv(dptr: *uint, po: *rust_port,
-                 yield: *libc::uintptr_t);
-    fn rust_port_select(dptr: **rust_port, ports: **rust_port,
-                        n_ports: libc::size_t,
-                        yield: *libc::uintptr_t);
-    fn rust_port_take(port_id: port_id) -> *rust_port;
-    fn rust_port_drop(p: *rust_port);
-    fn rust_port_task(p: *rust_port) -> libc::uintptr_t;
-    fn get_task_id() -> libc::uintptr_t;
-}
-
-#[abi = "rust-intrinsic"]
-extern mod rusti {
-    fn init<T>() -> T;
-}
-
-
-/* Tests */
-
-
-#[test]
-fn create_port_and_chan() { let p = Port::<int>(); Chan(&p); }
-
-#[test]
-fn send_int() {
-    let p = Port::<int>();
-    let c = Chan(&p);
-    send(c, 22);
-}
-
-#[test]
-fn send_recv_fn() {
-    let p = Port::<int>();
-    let c = Chan::<int>(&p);
-    send(c, 42);
-    assert (recv(p) == 42);
-}
-
-#[test]
-fn send_recv_fn_infer() {
-    let p = Port();
-    let c = Chan(&p);
-    send(c, 42);
-    assert (recv(p) == 42);
-}
-
-#[test]
-fn chan_chan_infer() {
-    let p = Port(), p2 = Port::<int>();
-    let c = Chan(&p);
-    send(c, Chan(&p2));
-    recv(p);
-}
-
-#[test]
-fn chan_chan() {
-    let p = Port::<Chan<int>>(), p2 = Port::<int>();
-    let c = Chan(&p);
-    send(c, Chan(&p2));
-    recv(p);
-}
-
-#[test]
-fn test_peek() {
-    let po = Port();
-    let ch = Chan(&po);
-    assert !peek(po);
-    send(ch, ());
-    assert peek(po);
-    recv(po);
-    assert !peek(po);
-}
-
-#[test]
-fn test_select2_available() {
-    let po_a = Port();
-    let po_b = Port();
-    let ch_a = Chan(&po_a);
-    let ch_b = Chan(&po_b);
-
-    send(ch_a, ~"a");
-
-    assert select2(po_a, po_b) == either::Left(~"a");
-
-    send(ch_b, ~"b");
-
-    assert select2(po_a, po_b) == either::Right(~"b");
-}
-
-#[test]
-fn test_select2_rendezvous() {
-    let po_a = Port();
-    let po_b = Port();
-    let ch_a = Chan(&po_a);
-    let ch_b = Chan(&po_b);
-
-    for iter::repeat(10) {
-        do task::spawn {
-            for iter::repeat(10) { task::yield() }
-            send(ch_a, ~"a");
-        };
-
-        assert select2(po_a, po_b) == either::Left(~"a");
-
-        do task::spawn {
-            for iter::repeat(10) { task::yield() }
-            send(ch_b, ~"b");
-        };
-
-        assert select2(po_a, po_b) == either::Right(~"b");
-    }
-}
-
-#[test]
-fn test_select2_stress() {
-    let po_a = Port();
-    let po_b = Port();
-    let ch_a = Chan(&po_a);
-    let ch_b = Chan(&po_b);
-
-    let msgs = 100;
-    let times = 4u;
-
-    for iter::repeat(times) {
-        do task::spawn {
-            for iter::repeat(msgs) {
-                send(ch_a, ~"a")
-            }
-        };
-        do task::spawn {
-            for iter::repeat(msgs) {
-                send(ch_b, ~"b")
-            }
-        };
-    }
-
-    let mut as_ = 0;
-    let mut bs = 0;
-    for iter::repeat(msgs * times * 2u) {
-        match select2(po_a, po_b) {
-          either::Left(~"a") => as_ += 1,
-          either::Right(~"b") => bs += 1,
-          _ => fail ~"test_select_2_stress failed"
-        }
-    }
-
-    assert as_ == 400;
-    assert bs == 400;
-}
-
-#[test]
-fn test_recv_chan() {
-    let po = Port();
-    let ch = Chan(&po);
-    send(ch, ~"flower");
-    assert recv_chan(ch) == ~"flower";
-}
-
-#[test]
-#[should_fail]
-#[ignore(cfg(windows))]
-fn test_recv_chan_dead() {
-    let ch = Chan(&Port());
-    send(ch, ~"flower");
-    recv_chan(ch);
-}
-
-#[test]
-#[ignore(cfg(windows))]
-fn test_recv_chan_wrong_task() {
-    let po = Port();
-    let ch = Chan(&po);
-    send(ch, ~"flower");
-    assert result::is_err(&task::try(||
-        recv_chan(ch)
-    ))
-}
-
-#[test]
-fn test_port_send() {
-    let po = Port();
-    po.send(());
-    po.recv();
-}
-
-#[test]
-fn test_chan_peek() {
-    let po = Port();
-    let ch = po.chan();
-    ch.send(());
-    assert ch.peek();
-}
-
-#[test]
-fn test_listen() {
-    do listen |parent| {
-        do task::spawn {
-            parent.send(~"oatmeal-salad");
-        }
-        assert parent.recv() == ~"oatmeal-salad";
-    }
-}
-
-#[test]
-#[ignore(cfg(windows))]
-fn test_port_detach_fail() {
-    for iter::repeat(100) {
-        do task::spawn_unlinked {
-            let po = Port();
-            let ch = po.chan();
-
-            do task::spawn {
-                fail;
-            }
-
-            do task::spawn {
-                ch.send(());
-            }
-        }
-    }
-}
index eb7d753ea08bab51ddf66a08e7003a6a25e02aed..70d6e0898c73ef5514adaec359cbaa48c2c706b5 100644 (file)
@@ -139,7 +139,7 @@ pub mod send_map;
 
 /* Tasks and communication */
 
-pub mod comm;
+pub mod oldcomm;
 #[path = "task/mod.rs"]
 pub mod task;
 pub mod pipes;
diff --git a/src/libcore/oldcomm.rs b/src/libcore/oldcomm.rs
new file mode 100644 (file)
index 0000000..a5b0336
--- /dev/null
@@ -0,0 +1,516 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+/*!
+
+Deprecated communication between tasks
+
+Communication between tasks is facilitated by ports (in the receiving
+task), and channels (in the sending task). Any number of channels may
+feed into a single port.  Ports and channels may only transmit values
+of unique types; that is, values that are statically guaranteed to be
+accessed by a single 'owner' at a time.  Unique types include scalars,
+vectors, strings, and records, tags, tuples and unique boxes (`~T`)
+thereof. Most notably, shared boxes (`@T`) may not be transmitted
+across channels.
+
+# Example
+
+~~~
+let po = comm::Port();
+let ch = comm::Chan(po);
+
+do task::spawn {
+    comm::send(ch, "Hello, World");
+}
+
+io::println(comm::recv(p));
+~~~
+
+# Note
+
+Use of this module is deprecated in favor of `core::pipes`. In the
+`core::comm` will likely be rewritten with pipes, at which point it
+will once again be the preferred module for intertask communication.
+
+*/
+
+// NB: transitionary, de-mode-ing.
+#[forbid(deprecated_mode)];
+#[forbid(deprecated_pattern)];
+
+use either::Either;
+use libc::size_t;
+// After snapshot, change p2::addr_of => addr_of
+
+/**
+ * A communication endpoint that can receive messages
+ *
+ * Each port has a unique per-task identity and may not be replicated or
+ * transmitted. If a port value is copied, both copies refer to the same
+ * port.  Ports may be associated with multiple `chan`s.
+ */
+pub enum Port<T: Owned> {
+    Port_(@PortPtr<T>)
+}
+
+// It's critical that this only have one variant, so it has a record
+// layout, and will work in the rust_task structure in task.rs.
+/**
+ * A communication endpoint that can send messages
+ *
+ * Each channel is bound to a port when the channel is constructed, so
+ * the destination port for a channel must exist before the channel
+ * itself.  Channels are weak: a channel does not keep the port it is
+ * bound to alive. If a channel attempts to send data to a dead port that
+ * data will be silently dropped.  Channels may be duplicated and
+ * themselves transmitted over other channels.
+ */
+pub enum Chan<T: Owned> {
+    Chan_(port_id)
+}
+
+/// Constructs a port
+pub fn Port<T: Owned>() -> Port<T> {
+    Port_(@PortPtr(rustrt::new_port(sys::size_of::<T>() as size_t)))
+}
+
+impl<T: Owned> Port<T> {
+
+    fn chan() -> Chan<T> { Chan(&self) }
+    fn send(v: T) { self.chan().send(move v) }
+    fn recv() -> T { recv(self) }
+    fn peek() -> bool { peek(self) }
+
+}
+
+impl<T: Owned> Chan<T> {
+
+    fn chan() -> Chan<T> { self }
+    fn send(v: T) { send(self, move v) }
+    fn recv() -> T { recv_chan(self) }
+    fn peek() -> bool { peek_chan(self) }
+
+}
+
+/// Open a new receiving channel for the duration of a function
+pub fn listen<T: Owned, U>(f: fn(Chan<T>) -> U) -> U {
+    let po = Port();
+    f(po.chan())
+}
+
+struct PortPtr<T:Owned> {
+    po: *rust_port,
+  drop unsafe {
+      do task::unkillable {
+        // Once the port is detached it's guaranteed not to receive further
+        // messages
+        let yield = 0;
+        let yieldp = ptr::addr_of(&yield);
+        rustrt::rust_port_begin_detach(self.po, yieldp);
+        if yield != 0 {
+            // Need to wait for the port to be detached
+            task::yield();
+        }
+        rustrt::rust_port_end_detach(self.po);
+
+        // Drain the port so that all the still-enqueued items get dropped
+        while rustrt::rust_port_size(self.po) > 0 as size_t {
+            recv_::<T>(self.po);
+        }
+        rustrt::del_port(self.po);
+    }
+  }
+}
+
+fn PortPtr<T: Owned>(po: *rust_port) -> PortPtr<T> {
+    PortPtr {
+        po: po
+    }
+}
+
+/**
+ * Internal function for converting from a channel to a port
+ *
+ * # Failure
+ *
+ * Fails if the port is detached or dead. Fails if the port
+ * is owned by a different task.
+ */
+fn as_raw_port<T: Owned, U>(ch: Chan<T>, f: fn(*rust_port) -> U) -> U {
+
+    struct PortRef {
+        p: *rust_port,
+       drop {
+         if !ptr::is_null(self.p) {
+           rustrt::rust_port_drop(self.p);
+         }
+       }
+    }
+
+    fn PortRef(p: *rust_port) -> PortRef {
+        PortRef {
+            p: p
+        }
+    }
+
+    let p = PortRef(rustrt::rust_port_take(*ch));
+
+    if ptr::is_null(p.p) {
+        fail ~"unable to locate port for channel"
+    } else if rustrt::get_task_id() != rustrt::rust_port_task(p.p) {
+        fail ~"unable to access unowned port"
+    }
+
+    f(p.p)
+}
+
+/**
+ * Constructs a channel. The channel is bound to the port used to
+ * construct it.
+ */
+pub fn Chan<T: Owned>(p: &Port<T>) -> Chan<T> {
+    Chan_(rustrt::get_port_id((**p).po))
+}
+
+/**
+ * Sends data over a channel. The sent data is moved into the channel,
+ * whereupon the caller loses access to it.
+ */
+pub fn send<T: Owned>(ch: Chan<T>, data: T) {
+    let Chan_(p) = ch;
+    let data_ptr = ptr::addr_of(&data) as *();
+    let res = rustrt::rust_port_id_send(p, data_ptr);
+    if res != 0 unsafe {
+        // Data sent successfully
+        cast::forget(move data);
+    }
+    task::yield();
+}
+
+/**
+ * Receive from a port.  If no data is available on the port then the
+ * task will block until data becomes available.
+ */
+pub fn recv<T: Owned>(p: Port<T>) -> T { recv_((**p).po) }
+
+/// Returns true if there are messages available
+pub fn peek<T: Owned>(p: Port<T>) -> bool { peek_((**p).po) }
+
+#[doc(hidden)]
+pub fn recv_chan<T: Owned>(ch: Chan<T>) -> T {
+    as_raw_port(ch, |x|recv_(x))
+}
+
+fn peek_chan<T: Owned>(ch: Chan<T>) -> bool {
+    as_raw_port(ch, |x|peek_(x))
+}
+
+/// Receive on a raw port pointer
+fn recv_<T: Owned>(p: *rust_port) -> T {
+    let yield = 0;
+    let yieldp = ptr::addr_of(&yield);
+    let mut res;
+    res = rusti::init::<T>();
+    rustrt::port_recv(ptr::addr_of(&res) as *uint, p, yieldp);
+
+    if yield != 0 {
+        // Data isn't available yet, so res has not been initialized.
+        task::yield();
+    } else {
+        // In the absence of compiler-generated preemption points
+        // this is a good place to yield
+        task::yield();
+    }
+    move res
+}
+
+fn peek_(p: *rust_port) -> bool {
+    // Yield here before we check to see if someone sent us a message
+    // FIXME #524, if the compiler generates yields, we don't need this
+    task::yield();
+    rustrt::rust_port_size(p) != 0 as libc::size_t
+}
+
+/// Receive on one of two ports
+pub fn select2<A: Owned, B: Owned>(p_a: Port<A>, p_b: Port<B>)
+    -> Either<A, B> {
+    let ports = ~[(**p_a).po, (**p_b).po];
+    let yield = 0, yieldp = ptr::addr_of(&yield);
+
+    let mut resport: *rust_port;
+    resport = rusti::init::<*rust_port>();
+    do vec::as_imm_buf(ports) |ports, n_ports| {
+        rustrt::rust_port_select(ptr::addr_of(&resport), ports,
+                                 n_ports as size_t, yieldp);
+    }
+
+    if yield != 0 {
+        // Wait for data
+        task::yield();
+    } else {
+        // As in recv, this is a good place to yield anyway until
+        // the compiler generates yield calls
+        task::yield();
+    }
+
+    // Now we know the port we're supposed to receive from
+    assert resport != ptr::null();
+
+    if resport == (**p_a).po {
+        either::Left(recv(p_a))
+    } else if resport == (**p_b).po {
+        either::Right(recv(p_b))
+    } else {
+        fail ~"unexpected result from rust_port_select";
+    }
+}
+
+
+/* Implementation details */
+
+#[allow(non_camel_case_types)] // runtime type
+enum rust_port {}
+
+#[allow(non_camel_case_types)] // runtime type
+type port_id = int;
+
+#[abi = "cdecl"]
+extern mod rustrt {
+    fn rust_port_id_send(target_port: port_id, data: *()) -> libc::uintptr_t;
+
+    fn new_port(unit_sz: libc::size_t) -> *rust_port;
+    fn del_port(po: *rust_port);
+    fn rust_port_begin_detach(po: *rust_port,
+                              yield: *libc::uintptr_t);
+    fn rust_port_end_detach(po: *rust_port);
+    fn get_port_id(po: *rust_port) -> port_id;
+    fn rust_port_size(po: *rust_port) -> libc::size_t;
+    fn port_recv(dptr: *uint, po: *rust_port,
+                 yield: *libc::uintptr_t);
+    fn rust_port_select(dptr: **rust_port, ports: **rust_port,
+                        n_ports: libc::size_t,
+                        yield: *libc::uintptr_t);
+    fn rust_port_take(port_id: port_id) -> *rust_port;
+    fn rust_port_drop(p: *rust_port);
+    fn rust_port_task(p: *rust_port) -> libc::uintptr_t;
+    fn get_task_id() -> libc::uintptr_t;
+}
+
+#[abi = "rust-intrinsic"]
+extern mod rusti {
+    fn init<T>() -> T;
+}
+
+
+/* Tests */
+
+
+#[test]
+fn create_port_and_chan() { let p = Port::<int>(); Chan(&p); }
+
+#[test]
+fn send_int() {
+    let p = Port::<int>();
+    let c = Chan(&p);
+    send(c, 22);
+}
+
+#[test]
+fn send_recv_fn() {
+    let p = Port::<int>();
+    let c = Chan::<int>(&p);
+    send(c, 42);
+    assert (recv(p) == 42);
+}
+
+#[test]
+fn send_recv_fn_infer() {
+    let p = Port();
+    let c = Chan(&p);
+    send(c, 42);
+    assert (recv(p) == 42);
+}
+
+#[test]
+fn chan_chan_infer() {
+    let p = Port(), p2 = Port::<int>();
+    let c = Chan(&p);
+    send(c, Chan(&p2));
+    recv(p);
+}
+
+#[test]
+fn chan_chan() {
+    let p = Port::<Chan<int>>(), p2 = Port::<int>();
+    let c = Chan(&p);
+    send(c, Chan(&p2));
+    recv(p);
+}
+
+#[test]
+fn test_peek() {
+    let po = Port();
+    let ch = Chan(&po);
+    assert !peek(po);
+    send(ch, ());
+    assert peek(po);
+    recv(po);
+    assert !peek(po);
+}
+
+#[test]
+fn test_select2_available() {
+    let po_a = Port();
+    let po_b = Port();
+    let ch_a = Chan(&po_a);
+    let ch_b = Chan(&po_b);
+
+    send(ch_a, ~"a");
+
+    assert select2(po_a, po_b) == either::Left(~"a");
+
+    send(ch_b, ~"b");
+
+    assert select2(po_a, po_b) == either::Right(~"b");
+}
+
+#[test]
+fn test_select2_rendezvous() {
+    let po_a = Port();
+    let po_b = Port();
+    let ch_a = Chan(&po_a);
+    let ch_b = Chan(&po_b);
+
+    for iter::repeat(10) {
+        do task::spawn {
+            for iter::repeat(10) { task::yield() }
+            send(ch_a, ~"a");
+        };
+
+        assert select2(po_a, po_b) == either::Left(~"a");
+
+        do task::spawn {
+            for iter::repeat(10) { task::yield() }
+            send(ch_b, ~"b");
+        };
+
+        assert select2(po_a, po_b) == either::Right(~"b");
+    }
+}
+
+#[test]
+fn test_select2_stress() {
+    let po_a = Port();
+    let po_b = Port();
+    let ch_a = Chan(&po_a);
+    let ch_b = Chan(&po_b);
+
+    let msgs = 100;
+    let times = 4u;
+
+    for iter::repeat(times) {
+        do task::spawn {
+            for iter::repeat(msgs) {
+                send(ch_a, ~"a")
+            }
+        };
+        do task::spawn {
+            for iter::repeat(msgs) {
+                send(ch_b, ~"b")
+            }
+        };
+    }
+
+    let mut as_ = 0;
+    let mut bs = 0;
+    for iter::repeat(msgs * times * 2u) {
+        match select2(po_a, po_b) {
+          either::Left(~"a") => as_ += 1,
+          either::Right(~"b") => bs += 1,
+          _ => fail ~"test_select_2_stress failed"
+        }
+    }
+
+    assert as_ == 400;
+    assert bs == 400;
+}
+
+#[test]
+fn test_recv_chan() {
+    let po = Port();
+    let ch = Chan(&po);
+    send(ch, ~"flower");
+    assert recv_chan(ch) == ~"flower";
+}
+
+#[test]
+#[should_fail]
+#[ignore(cfg(windows))]
+fn test_recv_chan_dead() {
+    let ch = Chan(&Port());
+    send(ch, ~"flower");
+    recv_chan(ch);
+}
+
+#[test]
+#[ignore(cfg(windows))]
+fn test_recv_chan_wrong_task() {
+    let po = Port();
+    let ch = Chan(&po);
+    send(ch, ~"flower");
+    assert result::is_err(&task::try(||
+        recv_chan(ch)
+    ))
+}
+
+#[test]
+fn test_port_send() {
+    let po = Port();
+    po.send(());
+    po.recv();
+}
+
+#[test]
+fn test_chan_peek() {
+    let po = Port();
+    let ch = po.chan();
+    ch.send(());
+    assert ch.peek();
+}
+
+#[test]
+fn test_listen() {
+    do listen |parent| {
+        do task::spawn {
+            parent.send(~"oatmeal-salad");
+        }
+        assert parent.recv() == ~"oatmeal-salad";
+    }
+}
+
+#[test]
+#[ignore(cfg(windows))]
+fn test_port_detach_fail() {
+    for iter::repeat(100) {
+        do task::spawn_unlinked {
+            let po = Port();
+            let ch = po.chan();
+
+            do task::spawn {
+                fail;
+            }
+
+            do task::spawn {
+                ch.send(());
+            }
+        }
+    }
+}
index e32ac2019dbc78c74a393a82ae1ae32eca75d473..b5e0983a420d1142f51322b0281ec28f377cbe4e 100644 (file)
@@ -133,36 +133,36 @@ mod global_env {
     }
 
     enum Msg {
-        MsgGetEnv(~str, comm::Chan<Option<~str>>),
-        MsgSetEnv(~str, ~str, comm::Chan<()>),
-        MsgEnv(comm::Chan<~[(~str,~str)]>)
+        MsgGetEnv(~str, oldcomm::Chan<Option<~str>>),
+        MsgSetEnv(~str, ~str, oldcomm::Chan<()>),
+        MsgEnv(oldcomm::Chan<~[(~str,~str)]>)
     }
 
     pub fn getenv(n: &str) -> Option<~str> {
         let env_ch = get_global_env_chan();
-        let po = comm::Port();
-        comm::send(env_ch, MsgGetEnv(str::from_slice(n),
-                                     comm::Chan(&po)));
-        comm::recv(po)
+        let po = oldcomm::Port();
+        oldcomm::send(env_ch, MsgGetEnv(str::from_slice(n),
+                                     oldcomm::Chan(&po)));
+        oldcomm::recv(po)
     }
 
     pub fn setenv(n: &str, v: &str) {
         let env_ch = get_global_env_chan();
-        let po = comm::Port();
-        comm::send(env_ch, MsgSetEnv(str::from_slice(n),
+        let po = oldcomm::Port();
+        oldcomm::send(env_ch, MsgSetEnv(str::from_slice(n),
                                      str::from_slice(v),
-                                     comm::Chan(&po)));
-        comm::recv(po)
+                                     oldcomm::Chan(&po)));
+        oldcomm::recv(po)
     }
 
     pub fn env() -> ~[(~str,~str)] {
         let env_ch = get_global_env_chan();
-        let po = comm::Port();
-        comm::send(env_ch, MsgEnv(comm::Chan(&po)));
-        comm::recv(po)
+        let po = oldcomm::Port();
+        oldcomm::send(env_ch, MsgEnv(oldcomm::Chan(&po)));
+        oldcomm::recv(po)
     }
 
-    fn get_global_env_chan() -> comm::Chan<Msg> {
+    fn get_global_env_chan() -> oldcomm::Chan<Msg> {
         let global_ptr = rustrt::rust_global_env_chan_ptr();
         unsafe {
             private::chan_from_global_ptr(global_ptr, || {
@@ -173,19 +173,19 @@ fn get_global_env_chan() -> comm::Chan<Msg> {
         }
     }
 
-    fn global_env_task(msg_po: comm::Port<Msg>) {
+    fn global_env_task(msg_po: oldcomm::Port<Msg>) {
         unsafe {
             do private::weaken_task |weak_po| {
                 loop {
-                    match comm::select2(msg_po, weak_po) {
+                    match oldcomm::select2(msg_po, weak_po) {
                       either::Left(MsgGetEnv(ref n, resp_ch)) => {
-                        comm::send(resp_ch, impl_::getenv(*n))
+                        oldcomm::send(resp_ch, impl_::getenv(*n))
                       }
                       either::Left(MsgSetEnv(ref n, ref v, resp_ch)) => {
-                        comm::send(resp_ch, impl_::setenv(*n, *v))
+                        oldcomm::send(resp_ch, impl_::setenv(*n, *v))
                       }
                       either::Left(MsgEnv(resp_ch)) => {
-                        comm::send(resp_ch, impl_::env())
+                        oldcomm::send(resp_ch, impl_::env())
                       }
                       either::Right(_) => break
                     }
index fdee648403cba5f2fb16f587f20179dfcd81f2fd..2d597bfb1b5f3271bc026fc17996e75c9d33974b 100644 (file)
@@ -55,8 +55,8 @@ fn compare_and_swap(address: &mut int, oldval: int, newval: int) -> bool {
 pub unsafe fn chan_from_global_ptr<T: Owned>(
     global: GlobalPtr,
     task_fn: fn() -> task::TaskBuilder,
-    f: fn~(comm::Port<T>)
-) -> comm::Chan<T> {
+    f: fn~(oldcomm::Port<T>)
+) -> oldcomm::Chan<T> {
 
     enum Msg {
         Proceed,
@@ -74,12 +74,12 @@ enum Msg {
         let (setup2_po, setup2_ch) = pipes::stream();
 
         // XXX: Ugly type inference hints
-        let setup1_po: pipes::Port<comm::Chan<T>> = setup1_po;
+        let setup1_po: pipes::Port<oldcomm::Chan<T>> = setup1_po;
         let setup2_po: pipes::Port<Msg> = setup2_po;
 
         do task_fn().spawn |move f, move setup1_ch, move setup2_po| {
-            let po = comm::Port::<T>();
-            let ch = comm::Chan(&po);
+            let po = oldcomm::Port::<T>();
+            let ch = oldcomm::Chan(&po);
             setup1_ch.send(ch);
 
             // Wait to hear if we are the official instance of
@@ -130,29 +130,29 @@ pub fn test_from_global_chan1() {
     // Create the global channel, attached to a new task
     let ch = unsafe {
         do chan_from_global_ptr(globchanp, task::task) |po| {
-            let ch = comm::recv(po);
-            comm::send(ch, true);
-            let ch = comm::recv(po);
-            comm::send(ch, true);
+            let ch = oldcomm::recv(po);
+            oldcomm::send(ch, true);
+            let ch = oldcomm::recv(po);
+            oldcomm::send(ch, true);
         }
     };
     // Talk to it
-    let po = comm::Port();
-    comm::send(ch, comm::Chan(&po));
-    assert comm::recv(po) == true;
+    let po = oldcomm::Port();
+    oldcomm::send(ch, oldcomm::Chan(&po));
+    assert oldcomm::recv(po) == true;
 
     // This one just reuses the previous channel
     let ch = unsafe {
         do chan_from_global_ptr(globchanp, task::task) |po| {
-            let ch = comm::recv(po);
-            comm::send(ch, false);
+            let ch = oldcomm::recv(po);
+            oldcomm::send(ch, false);
         }
     };
 
     // Talk to the original global task
-    let po = comm::Port();
-    comm::send(ch, comm::Chan(&po));
-    assert comm::recv(po) == true;
+    let po = oldcomm::Port();
+    oldcomm::send(ch, oldcomm::Chan(&po));
+    assert oldcomm::recv(po) == true;
 }
 
 #[test]
@@ -163,8 +163,8 @@ pub fn test_from_global_chan2() {
         let globchan = 0;
         let globchanp = ptr::addr_of(&globchan);
 
-        let resultpo = comm::Port();
-        let resultch = comm::Chan(&resultpo);
+        let resultpo = oldcomm::Port();
+        let resultch = oldcomm::Chan(&resultpo);
 
         // Spawn a bunch of tasks that all want to compete to
         // create the global channel
@@ -175,23 +175,23 @@ pub fn test_from_global_chan2() {
                         globchanp, task::task) |po| {
 
                         for uint::range(0, 10) |_j| {
-                            let ch = comm::recv(po);
-                            comm::send(ch, {i});
+                            let ch = oldcomm::recv(po);
+                            oldcomm::send(ch, {i});
                         }
                     }
                 };
-                let po = comm::Port();
-                comm::send(ch, comm::Chan(&po));
+                let po = oldcomm::Port();
+                oldcomm::send(ch, oldcomm::Chan(&po));
                 // We are The winner if our version of the
                 // task was installed
-                let winner = comm::recv(po);
-                comm::send(resultch, winner == i);
+                let winner = oldcomm::recv(po);
+                oldcomm::send(resultch, winner == i);
             }
         }
         // There should be only one winner
         let mut winners = 0u;
         for uint::range(0u, 10u) |_i| {
-            let res = comm::recv(resultpo);
+            let res = oldcomm::recv(resultpo);
             if res { winners += 1u };
         }
         assert winners == 1u;
@@ -217,9 +217,9 @@ pub fn test_from_global_chan2() {
  * * Weak tasks must not be supervised. A supervised task keeps
  *   a reference to its parent, so the parent will not die.
  */
-pub unsafe fn weaken_task(f: fn(comm::Port<()>)) {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+pub unsafe fn weaken_task(f: fn(oldcomm::Port<()>)) {
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     unsafe {
         rustrt::rust_task_weaken(cast::reinterpret_cast(&ch));
     }
@@ -227,13 +227,13 @@ pub unsafe fn weaken_task(f: fn(comm::Port<()>)) {
     f(po);
 
     struct Unweaken {
-      ch: comm::Chan<()>,
+      ch: oldcomm::Chan<()>,
       drop unsafe {
         rustrt::rust_task_unweaken(cast::reinterpret_cast(&self.ch));
       }
     }
 
-    fn Unweaken(ch: comm::Chan<()>) -> Unweaken {
+    fn Unweaken(ch: oldcomm::Chan<()>) -> Unweaken {
         Unweaken {
             ch: ch
         }
@@ -255,7 +255,7 @@ pub fn test_weaken_task_wait() {
     do task::spawn_unlinked {
         unsafe {
             do weaken_task |po| {
-                comm::recv(po);
+                oldcomm::recv(po);
             }
         }
     }
@@ -275,7 +275,7 @@ pub fn test_weaken_task_stress() {
             unsafe {
                 do weaken_task |po| {
                     // Wait for it to tell us to die
-                    comm::recv(po);
+                    oldcomm::recv(po);
                 }
             }
         }
index daebe0d31b4fde99fcff7fa7e2a1cd2cc01a1e5f..3af854236e1fa2a26aeaa53b178259fe9b96877a 100644 (file)
@@ -307,22 +307,22 @@ pub fn program_output(prog: &str, args: &[~str]) ->
     // in parallel so we don't deadlock while blocking on one
     // or the other. FIXME (#2625): Surely there's a much more
     // clever way to do this.
-    let p = comm::Port();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
     do task::spawn_sched(task::SingleThreaded) {
         let errput = readclose(pipe_err.in);
-        comm::send(ch, (2, move errput));
+        oldcomm::send(ch, (2, move errput));
     };
     do task::spawn_sched(task::SingleThreaded) {
         let output = readclose(pipe_out.in);
-        comm::send(ch, (1, move output));
+        oldcomm::send(ch, (1, move output));
     };
     let status = run::waitpid(pid);
     let mut errs = ~"";
     let mut outs = ~"";
     let mut count = 2;
     while count > 0 {
-        let stream = comm::recv(p);
+        let stream = oldcomm::recv(p);
         match stream {
             (1, copy s) => {
                 outs = move s;
index c024781c43018c99d8c178b33b11cb1d5ee99734..3cd12a5ba66ed009dce230bc276659cc8d3f09a2 100644 (file)
@@ -447,18 +447,18 @@ fn spawn_with<A: Owned>(arg: A, f: fn~(v: A)) {
      * Fails if a future_result was already set for this task.
      */
     fn try<T: Owned>(f: fn~() -> T) -> Result<T,()> {
-        let po = comm::Port();
-        let ch = comm::Chan(&po);
+        let po = oldcomm::Port();
+        let ch = oldcomm::Chan(&po);
         let mut result = None;
 
         let fr_task_builder = self.future_result(|+r| {
             result = Some(move r);
         });
         do fr_task_builder.spawn |move f| {
-            comm::send(ch, f());
+            oldcomm::send(ch, f());
         }
         match option::unwrap(move result).recv() {
-            Success => result::Ok(comm::recv(po)),
+            Success => result::Ok(oldcomm::recv(po)),
             Failure => result::Err(())
         }
     }
@@ -679,17 +679,17 @@ fn test_cant_dup_task_builder() {
 
 #[test] #[ignore(cfg(windows))]
 fn test_spawn_unlinked_unsup_no_fail_down() { // grandchild sends on a port
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     do spawn_unlinked {
         do spawn_unlinked {
             // Give middle task a chance to fail-but-not-kill-us.
             for iter::repeat(16) { task::yield(); }
-            comm::send(ch, ()); // If killed first, grandparent hangs.
+            oldcomm::send(ch, ()); // If killed first, grandparent hangs.
         }
         fail; // Shouldn't kill either (grand)parent or (grand)child.
     }
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 #[test] #[ignore(cfg(windows))]
 fn test_spawn_unlinked_unsup_no_fail_up() { // child unlinked fails
@@ -709,8 +709,8 @@ fn test_spawn_unlinked_sup_fail_down() {
 
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_spawn_linked_sup_fail_up() { // child fails; parent fails
-    let po = comm::Port::<()>();
-    let _ch = comm::Chan(&po);
+    let po = oldcomm::Port::<()>();
+    let _ch = oldcomm::Chan(&po);
     // Unidirectional "parenting" shouldn't override bidirectional linked.
     // We have to cheat with opts - the interface doesn't support them because
     // they don't make sense (redundant with task().supervised()).
@@ -728,7 +728,7 @@ fn test_spawn_unlinked_sup_fail_down() {
         .. b0
     };
     do b1.spawn { fail; }
-    comm::recv(po); // We should get punted awake
+    oldcomm::recv(po); // We should get punted awake
 }
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_spawn_linked_sup_fail_down() { // parent fails; child fails
@@ -752,11 +752,11 @@ fn test_spawn_unlinked_sup_fail_down() {
 }
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_spawn_linked_unsup_fail_up() { // child fails; parent fails
-    let po = comm::Port::<()>();
-    let _ch = comm::Chan(&po);
+    let po = oldcomm::Port::<()>();
+    let _ch = oldcomm::Chan(&po);
     // Default options are to spawn linked & unsupervised.
     do spawn { fail; }
-    comm::recv(po); // We should get punted awake
+    oldcomm::recv(po); // We should get punted awake
 }
 #[test] #[should_fail] #[ignore(cfg(windows))]
 fn test_spawn_linked_unsup_fail_down() { // parent fails; child fails
@@ -824,27 +824,27 @@ fn test_spawn_linked_sup_propagate_sibling() {
 
 #[test]
 fn test_run_basic() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     do task().spawn {
-        comm::send(ch, ());
+        oldcomm::send(ch, ());
     }
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[test]
 fn test_add_wrapper() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     let b0 = task();
     let b1 = do b0.add_wrapper |body| {
         fn~(move body) {
             body();
-            comm::send(ch, ());
+            oldcomm::send(ch, ());
         }
     };
     do b1.spawn { }
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[test]
@@ -897,10 +897,10 @@ fn test_spawn_sched_no_threads() {
 
 #[test]
 fn test_spawn_sched() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
 
-    fn f(i: int, ch: comm::Chan<()>) {
+    fn f(i: int, ch: oldcomm::Chan<()>) {
         let parent_sched_id = rt::rust_get_sched_id();
 
         do spawn_sched(SingleThreaded) {
@@ -908,7 +908,7 @@ fn f(i: int, ch: comm::Chan<()>) {
             assert parent_sched_id != child_sched_id;
 
             if (i == 0) {
-                comm::send(ch, ());
+                oldcomm::send(ch, ());
             } else {
                 f(i - 1, ch);
             }
@@ -916,13 +916,13 @@ fn f(i: int, ch: comm::Chan<()>) {
 
     }
     f(10, ch);
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[test]
 fn test_spawn_sched_childs_on_same_sched() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
 
     do spawn_sched(SingleThreaded) {
         let parent_sched_id = rt::rust_get_sched_id();
@@ -930,11 +930,11 @@ fn test_spawn_sched_childs_on_same_sched() {
             let child_sched_id = rt::rust_get_sched_id();
             // This should be on the same scheduler
             assert parent_sched_id == child_sched_id;
-            comm::send(ch, ());
+            oldcomm::send(ch, ());
         };
     };
 
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[nolink]
@@ -955,71 +955,71 @@ fn test_spawn_sched_blocking() {
     // without affecting other schedulers
     for iter::repeat(20u) {
 
-        let start_po = comm::Port();
-        let start_ch = comm::Chan(&start_po);
-        let fin_po = comm::Port();
-        let fin_ch = comm::Chan(&fin_po);
+        let start_po = oldcomm::Port();
+        let start_ch = oldcomm::Chan(&start_po);
+        let fin_po = oldcomm::Port();
+        let fin_ch = oldcomm::Chan(&fin_po);
 
         let lock = testrt::rust_dbg_lock_create();
 
         do spawn_sched(SingleThreaded) {
             testrt::rust_dbg_lock_lock(lock);
 
-            comm::send(start_ch, ());
+            oldcomm::send(start_ch, ());
 
             // Block the scheduler thread
             testrt::rust_dbg_lock_wait(lock);
             testrt::rust_dbg_lock_unlock(lock);
 
-            comm::send(fin_ch, ());
+            oldcomm::send(fin_ch, ());
         };
 
         // Wait until the other task has its lock
-        comm::recv(start_po);
+        oldcomm::recv(start_po);
 
-        fn pingpong(po: comm::Port<int>, ch: comm::Chan<int>) {
+        fn pingpong(po: oldcomm::Port<int>, ch: oldcomm::Chan<int>) {
             let mut val = 20;
             while val > 0 {
-                val = comm::recv(po);
-                comm::send(ch, val - 1);
+                val = oldcomm::recv(po);
+                oldcomm::send(ch, val - 1);
             }
         }
 
-        let setup_po = comm::Port();
-        let setup_ch = comm::Chan(&setup_po);
-        let parent_po = comm::Port();
-        let parent_ch = comm::Chan(&parent_po);
+        let setup_po = oldcomm::Port();
+        let setup_ch = oldcomm::Chan(&setup_po);
+        let parent_po = oldcomm::Port();
+        let parent_ch = oldcomm::Chan(&parent_po);
         do spawn {
-            let child_po = comm::Port();
-            comm::send(setup_ch, comm::Chan(&child_po));
+            let child_po = oldcomm::Port();
+            oldcomm::send(setup_ch, oldcomm::Chan(&child_po));
             pingpong(child_po, parent_ch);
         };
 
-        let child_ch = comm::recv(setup_po);
-        comm::send(child_ch, 20);
+        let child_ch = oldcomm::recv(setup_po);
+        oldcomm::send(child_ch, 20);
         pingpong(parent_po, child_ch);
         testrt::rust_dbg_lock_lock(lock);
         testrt::rust_dbg_lock_signal(lock);
         testrt::rust_dbg_lock_unlock(lock);
-        comm::recv(fin_po);
+        oldcomm::recv(fin_po);
         testrt::rust_dbg_lock_destroy(lock);
     }
 }
 
 #[cfg(test)]
 fn avoid_copying_the_body(spawnfn: fn(v: fn~())) {
-    let p = comm::Port::<uint>();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port::<uint>();
+    let ch = oldcomm::Chan(&p);
 
     let x = ~1;
     let x_in_parent = ptr::addr_of(&(*x)) as uint;
 
     do spawnfn |move x| {
         let x_in_child = ptr::addr_of(&(*x)) as uint;
-        comm::send(ch, x_in_child);
+        oldcomm::send(ch, x_in_child);
     }
 
-    let x_in_child = comm::recv(p);
+    let x_in_child = oldcomm::recv(p);
     assert x_in_parent == x_in_child;
 }
 
@@ -1057,19 +1057,19 @@ fn test_avoid_copying_the_body_unlinked() {
 
 #[test]
 fn test_platform_thread() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     do task().sched_mode(PlatformThread).spawn {
-        comm::send(ch, ());
+        oldcomm::send(ch, ());
     }
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[test]
 #[ignore(cfg(windows))]
 #[should_fail]
 fn test_unkillable() {
-    let po = comm::Port();
+    let po = oldcomm::Port();
     let ch = po.chan();
 
     // We want to do this after failing
index e2ed853ee2932e7d6a3e6235b353ebd29428762a..77acf3967e8e02565d566f6db0090f94b9dbbb74 100644 (file)
@@ -646,12 +646,12 @@ fn new_task_in_new_sched(opts: SchedOpts) -> *rust_task {
 
 #[test]
 fn test_spawn_raw_simple() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     do spawn_raw(default_task_opts()) {
-        comm::send(ch, ());
+        oldcomm::send(ch, ());
     }
-    comm::recv(po);
+    oldcomm::recv(po);
 }
 
 #[test]
index 45aa78be02606fbb1b8adb08370479c3bc383339..c934b09a7c47b253dede4f9722e97862bd469ec5 100644 (file)
@@ -434,8 +434,8 @@ fails without recording a fatal error then we've encountered a compiler
 bug and need to present an error.
 */
 fn monitor(+f: fn~(diagnostic::emitter)) {
-    let p = comm::Port();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
 
     match do task::try |move f| {
 
@@ -444,14 +444,14 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
         let demitter = fn@(cmsp: Option<(@codemap::CodeMap, codemap::span)>,
                            msg: &str, lvl: diagnostic::level) {
             if lvl == diagnostic::fatal {
-                comm::send(ch, fatal);
+                oldcomm::send(ch, fatal);
             }
             diagnostic::emit(cmsp, msg, lvl);
         };
 
         struct finally {
-            ch: comm::Chan<monitor_msg>,
-            drop { comm::send(self.ch, done); }
+            ch: oldcomm::Chan<monitor_msg>,
+            drop { oldcomm::send(self.ch, done); }
         }
 
         let _finally = finally { ch: ch };
@@ -461,7 +461,7 @@ fn monitor(+f: fn~(diagnostic::emitter)) {
         result::Ok(_) => { /* fallthrough */ }
         result::Err(_) => {
             // Task failed without emitting a fatal diagnostic
-            if comm::recv(p) == done {
+            if oldcomm::recv(p) == done {
                 diagnostic::emit(
                     None,
                     diagnostic::ice_msg(~"unexpected failure"),
index 827db4211c495273851b3c43f74f08702588e2f6..14b7b52e4d360bd2fdff928f7b98ec484d7663a5 100644 (file)
@@ -46,7 +46,7 @@ enum Msg {
 }
 
 pub enum Srv = {
-    ch: comm::Chan<Msg>
+    ch: oldcomm::Chan<Msg>
 };
 
 impl Srv: Clone {
@@ -70,11 +70,11 @@ fn run<T>(owner: SrvOwner<T>, source: ~str, +parse: Parser) -> T {
     });
 
     let res = owner(srv_);
-    comm::send(srv_.ch, Exit);
+    oldcomm::send(srv_.ch, Exit);
     move res
 }
 
-fn act(po: comm::Port<Msg>, source: ~str, parse: Parser) {
+fn act(po: oldcomm::Port<Msg>, source: ~str, parse: Parser) {
     let sess = build_session();
 
     let ctxt = build_ctxt(
@@ -84,7 +84,7 @@ fn act(po: comm::Port<Msg>, source: ~str, parse: Parser) {
 
     let mut keep_going = true;
     while keep_going {
-        match comm::recv(po) {
+        match oldcomm::recv(po) {
           HandleRequest(f) => {
             f(ctxt);
           }
@@ -99,13 +99,13 @@ pub fn exec<T:Owned>(
     srv: Srv,
     +f: fn~(ctxt: Ctxt) -> T
 ) -> T {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     let msg = HandleRequest(fn~(move f, ctxt: Ctxt) {
-        comm::send(ch, f(ctxt))
+        oldcomm::send(ch, f(ctxt))
     });
-    comm::send(srv.ch, move msg);
-    comm::recv(po)
+    oldcomm::send(srv.ch, move msg);
+    oldcomm::recv(po)
 }
 
 fn build_ctxt(sess: Session,
index 193a824b55021d406a4928450f9ce3a1379a3c93..3328cdd527a86d3422a65a430ee4bcef33151504 100644 (file)
@@ -129,7 +129,7 @@ fn should_request_new_writer_for_each_page() {
     write_markdown(doc, move writer_factory);
     // We expect two pages to have been written
     for iter::repeat(2) {
-        comm::recv(po);
+        oldcomm::recv(po);
     }
 }
 
@@ -160,7 +160,7 @@ fn should_write_title_for_each_page() {
     let doc = (page_pass::mk_pass(config::DocPerMod).f)(srv, doc);
     write_markdown(doc, move writer_factory);
     for iter::repeat(2) {
-        let (page, markdown) = comm::recv(po);
+        let (page, markdown) = oldcomm::recv(po);
         match page {
           doc::CratePage(_) => {
             assert str::contains(markdown, ~"% Crate core");
@@ -304,7 +304,7 @@ fn should_write_full_path_to_mod() {
     assert str::contains(markdown, ~"# Module `a::b::c`");
 }
 
-fn write_common(
+fn write_oldcommon(
     ctxt: &Ctxt,
     +desc: Option<~str>,
     sections: &[doc::Section]
@@ -353,7 +353,7 @@ fn write_mod_contents(
     ctxt: &Ctxt,
     +doc: doc::ModDoc
 ) {
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
     if doc.index.is_some() {
         write_index(ctxt, doc.index.get());
     }
@@ -456,7 +456,7 @@ fn should_write_index_for_foreign_mods() {
 }
 
 fn write_nmod(ctxt: &Ctxt, +doc: doc::NmodDoc) {
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
     if doc.index.is_some() {
         write_index(ctxt, doc.index.get());
     }
@@ -507,7 +507,7 @@ fn write_fnlike(
     sections: &[doc::Section]
 ) {
     write_sig(ctxt, sig);
-    write_common(ctxt, desc, sections);
+    write_oldcommon(ctxt, desc, sections);
 }
 
 fn write_sig(ctxt: &Ctxt, +sig: Option<~str>) {
@@ -576,7 +576,7 @@ fn write_const(
     +doc: doc::ConstDoc
 ) {
     write_sig(ctxt, doc.sig);
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
 }
 
 #[test]
@@ -597,7 +597,7 @@ fn write_enum(
     ctxt: &Ctxt,
     +doc: doc::EnumDoc
 ) {
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
     write_variants(ctxt, doc.variants);
 }
 
@@ -678,7 +678,7 @@ fn should_write_variant_list_with_signatures() {
 }
 
 fn write_trait(ctxt: &Ctxt, +doc: doc::TraitDoc) {
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
     write_methods(ctxt, doc.methods);
 }
 
@@ -726,7 +726,7 @@ fn should_write_trait_method_signature() {
 }
 
 fn write_impl(ctxt: &Ctxt, +doc: doc::ImplDoc) {
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
     write_methods(ctxt, doc.methods);
 }
 
@@ -768,7 +768,7 @@ fn write_type(
     +doc: doc::TyDoc
 ) {
     write_sig(ctxt, doc.sig);
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
 }
 
 #[test]
@@ -795,7 +795,7 @@ fn write_struct(
     +doc: doc::StructDoc
 ) {
     write_sig(ctxt, doc.sig);
-    write_common(ctxt, doc.desc(), doc.sections());
+    write_oldcommon(ctxt, doc.desc(), doc.sections());
 }
 
 #[test]
@@ -854,7 +854,7 @@ fn write_markdown_str(
     ) -> ~str {
         let (writer_factory, po) = markdown_writer::future_writer_factory();
         write_markdown(doc, move writer_factory);
-        return comm::recv(po).second();
+        return oldcomm::recv(po).second();
     }
 
     fn write_markdown_str_srv(
@@ -864,7 +864,7 @@ fn write_markdown_str_srv(
         let (writer_factory, po) = markdown_writer::future_writer_factory();
         let pass = mk_pass(move writer_factory);
         (pass.f)(srv, doc);
-        return comm::recv(po).second();
+        return oldcomm::recv(po).second();
     }
 
     #[test]
index 0f03e7f4594e17451c7f52222bc6f6ea57ac8b86..9cf404e0533d5ba5546777d1899c24d18a9114b8 100644 (file)
@@ -151,8 +151,8 @@ fn readclose(fd: libc::c_int) -> ~str {
 fn generic_writer(+process: fn~(+markdown: ~str)) -> Writer {
     let (setup_po, setup_ch) = pipes::stream();
     do task::spawn |move process, move setup_ch| {
-        let po: comm::Port<WriteInstr> = comm::Port();
-        let ch = comm::Chan(&po);
+        let po: oldcomm::Port<WriteInstr> = oldcomm::Port();
+        let ch = oldcomm::Chan(&po);
         setup_ch.send(ch);
 
         let mut markdown = ~"";
@@ -168,7 +168,7 @@ fn generic_writer(+process: fn~(+markdown: ~str)) -> Writer {
     let ch = setup_po.recv();
 
     fn~(+instr: WriteInstr) {
-        comm::send(ch, instr);
+        oldcomm::send(ch, instr);
     }
 }
 
@@ -275,16 +275,16 @@ fn write_file(path: &Path, +s: ~str) {
 }
 
 pub fn future_writer_factory(
-) -> (WriterFactory, comm::Port<(doc::Page, ~str)>) {
-    let markdown_po = comm::Port();
-    let markdown_ch = comm::Chan(&markdown_po);
+) -> (WriterFactory, oldcomm::Port<(doc::Page, ~str)>) {
+    let markdown_po = oldcomm::Port();
+    let markdown_ch = oldcomm::Chan(&markdown_po);
     let writer_factory = fn~(+page: doc::Page) -> Writer {
         let (writer_po, writer_ch) = pipes::stream();
         do task::spawn |move writer_ch| {
             let (writer, future) = future_writer();
             writer_ch.send(move writer);
             let s = future.get();
-            comm::send(markdown_ch, (page, s));
+            oldcomm::send(markdown_ch, (page, s));
         }
         writer_po.recv()
     };
index 4bcb7c64ad0cf7ee297a7719cc972e1b353feda2..af8ac5f1427efcd9af54e583dce4a73c400dcecb 100644 (file)
@@ -41,22 +41,22 @@ fn run(
 
     let (result_port, page_chan) = do util::spawn_conversation
         |page_port, result_chan| {
-        comm::send(result_chan, make_doc_from_pages(page_port));
+        oldcomm::send(result_chan, make_doc_from_pages(page_port));
     };
 
     find_pages(doc, page_chan);
-    comm::recv(result_port)
+    oldcomm::recv(result_port)
 }
 
-type PagePort = comm::Port<Option<doc::Page>>;
-type PageChan = comm::Chan<Option<doc::Page>>;
+type PagePort = oldcomm::Port<Option<doc::Page>>;
+type PageChan = oldcomm::Chan<Option<doc::Page>>;
 
 type NominalPageChan = NominalOp<PageChan>;
 
 fn make_doc_from_pages(page_port: PagePort) -> doc::Doc {
     let mut pages = ~[];
     loop {
-        let val = comm::recv(page_port);
+        let val = oldcomm::recv(page_port);
         if val.is_some() {
             pages += ~[option::unwrap(move val)];
         } else {
@@ -77,7 +77,7 @@ fn find_pages(doc: doc::Doc, page_chan: PageChan) {
     };
     (fold.fold_doc)(&fold, doc);
 
-    comm::send(page_chan, None);
+    oldcomm::send(page_chan, None);
 }
 
 fn fold_crate(
@@ -92,7 +92,7 @@ fn fold_crate(
         .. doc
     });
 
-    comm::send(fold.ctxt.op, Some(page));
+    oldcomm::send(fold.ctxt.op, Some(page));
 
     doc
 }
@@ -108,7 +108,7 @@ fn fold_mod(
 
         let doc = strip_mod(doc);
         let page = doc::ItemPage(doc::ModTag(doc));
-        comm::send(fold.ctxt.op, Some(page));
+        oldcomm::send(fold.ctxt.op, Some(page));
     }
 
     doc
@@ -133,7 +133,7 @@ fn fold_nmod(
 ) -> doc::NmodDoc {
     let doc = fold::default_seq_fold_nmod(fold, doc);
     let page = doc::ItemPage(doc::NmodTag(doc));
-    comm::send(fold.ctxt.op, Some(page));
+    oldcomm::send(fold.ctxt.op, Some(page));
     return doc;
 }
 
index e1c810b19a4465318eb62e1fde216efdc37af58b..ebeb9346d3c499b496f6938903e600d2f0e695ac 100644 (file)
@@ -18,23 +18,23 @@ fn clone(&self) -> NominalOp<T> { copy *self }
 }
 
 pub fn spawn_listener<A: Owned>(
-    +f: fn~(comm::Port<A>)) -> comm::Chan<A> {
-    let setup_po = comm::Port();
-    let setup_ch = comm::Chan(&setup_po);
+    +f: fn~(oldcomm::Port<A>)) -> oldcomm::Chan<A> {
+    let setup_po = oldcomm::Port();
+    let setup_ch = oldcomm::Chan(&setup_po);
     do task::spawn |move f| {
-        let po = comm::Port();
-        let ch = comm::Chan(&po);
-        comm::send(setup_ch, ch);
+        let po = oldcomm::Port();
+        let ch = oldcomm::Chan(&po);
+        oldcomm::send(setup_ch, ch);
         f(move po);
     }
-    comm::recv(setup_po)
+    oldcomm::recv(setup_po)
 }
 
 pub fn spawn_conversation<A: Owned, B: Owned>
-    (+f: fn~(comm::Port<A>, comm::Chan<B>))
-    -> (comm::Port<B>, comm::Chan<A>) {
-    let from_child = comm::Port();
-    let to_parent = comm::Chan(&from_child);
+    (+f: fn~(oldcomm::Port<A>, oldcomm::Chan<B>))
+    -> (oldcomm::Port<B>, oldcomm::Chan<A>) {
+    let from_child = oldcomm::Port();
+    let to_parent = oldcomm::Chan(&from_child);
     let to_child = do spawn_listener |move f, from_parent| {
         f(from_parent, to_parent)
     };
index 31a62b50d90880b45fae0eb7ae5fefb3abd0e8bd..1eb970526c36bca3a6c2460159de12b2013bf087 100644 (file)
@@ -30,7 +30,6 @@
 use set_data_for_req = uv::ll::set_data_for_req;
 use get_data_for_req = uv::ll::get_data_for_req;
 use ll = uv::ll;
-use comm = core::comm;
 
 /// An IP address
 pub enum IpAddr {
@@ -108,7 +107,7 @@ enum IpGetAddrErr {
  */
 pub fn get_addr(node: &str, iotask: iotask)
         -> result::Result<~[IpAddr], IpGetAddrErr> {
-    do core::comm::listen |output_ch| {
+    do oldcomm::listen |output_ch| {
         do str::as_buf(node) |node_ptr, len| unsafe {
             log(debug, fmt!("slice len %?", len));
             let handle = create_uv_getaddrinfo_t();
@@ -268,7 +267,7 @@ pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
 }
 
 type GetAddrData = {
-    output_ch: comm::Chan<result::Result<~[IpAddr],IpGetAddrErr>>
+    output_ch: oldcomm::Chan<result::Result<~[IpAddr],IpGetAddrErr>>
 };
 
 extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
index 624824dede4f84b8375125df13728b504ca4a985..c94a7fd1125950947f18da3bb2b523f75cc26266 100644 (file)
@@ -19,7 +19,6 @@
 use result::{Result};
 use libc::size_t;
 use io::{Reader, ReaderUtil, Writer};
-use comm = core::comm;
 
 #[nolink]
 extern mod rustrt {
@@ -133,19 +132,19 @@ pub enum TcpConnectErrData {
 pub fn connect(input_ip: ip::IpAddr, port: uint,
            iotask: IoTask)
     -> result::Result<TcpSocket, TcpConnectErrData> unsafe {
-    let result_po = core::comm::Port::<ConnAttempt>();
-    let closed_signal_po = core::comm::Port::<()>();
+    let result_po = oldcomm::Port::<ConnAttempt>();
+    let closed_signal_po = oldcomm::Port::<()>();
     let conn_data = {
-        result_ch: core::comm::Chan(&result_po),
-        closed_signal_ch: core::comm::Chan(&closed_signal_po)
+        result_ch: oldcomm::Chan(&result_po),
+        closed_signal_ch: oldcomm::Chan(&closed_signal_po)
     };
     let conn_data_ptr = ptr::addr_of(&conn_data);
-    let reader_po = core::comm::Port::<result::Result<~[u8], TcpErrData>>();
+    let reader_po = oldcomm::Port::<result::Result<~[u8], TcpErrData>>();
     let stream_handle_ptr = malloc_uv_tcp_t();
     *(stream_handle_ptr as *mut uv::ll::uv_tcp_t) = uv::ll::tcp_t();
     let socket_data = @{
         reader_po: reader_po,
-        reader_ch: core::comm::Chan(&reader_po),
+        reader_ch: oldcomm::Chan(&reader_po),
         stream_handle_ptr: stream_handle_ptr,
         connect_req: uv::ll::connect_t(),
         write_req: uv::ll::write_t(),
@@ -217,7 +216,7 @@ pub fn connect(input_ip: ip::IpAddr, port: uint,
                 // immediate connect failure.. probably a garbage
                 // ip or somesuch
                 let err_data = uv::ll::get_last_err_data(loop_ptr);
-                core::comm::send((*conn_data_ptr).result_ch,
+                oldcomm::send((*conn_data_ptr).result_ch,
                            ConnFailure(err_data.to_tcp_err()));
                 uv::ll::set_data_for_uv_handle(stream_handle_ptr,
                                                conn_data_ptr);
@@ -228,18 +227,18 @@ pub fn connect(input_ip: ip::IpAddr, port: uint,
           _ => {
             // failure to create a tcp handle
             let err_data = uv::ll::get_last_err_data(loop_ptr);
-            core::comm::send((*conn_data_ptr).result_ch,
+            oldcomm::send((*conn_data_ptr).result_ch,
                        ConnFailure(err_data.to_tcp_err()));
           }
         }
     };
-    match core::comm::recv(result_po) {
+    match oldcomm::recv(result_po) {
       ConnSuccess => {
         log(debug, ~"tcp::connect - received success on result_po");
         result::Ok(TcpSocket(socket_data))
       }
       ConnFailure(ref err_data) => {
-        core::comm::recv(closed_signal_po);
+        oldcomm::recv(closed_signal_po);
         log(debug, ~"tcp::connect - received failure on result_po");
         // still have to free the malloc'd stream handle..
         rustrt::rust_uv_current_kernel_free(stream_handle_ptr
@@ -329,7 +328,7 @@ pub fn write_future(sock: &TcpSocket, raw_write_data: ~[u8])
  * `tcp_err_data` record
  */
 pub fn read_start(sock: &TcpSocket)
-    -> result::Result<comm::Port<
+    -> result::Result<oldcomm::Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> unsafe {
     let socket_data = ptr::addr_of(&(*(sock.socket_data)));
     read_start_common_impl(socket_data)
@@ -343,7 +342,7 @@ pub fn read_start(sock: &TcpSocket)
  * * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on
  */
 pub fn read_stop(sock: &TcpSocket,
-             read_port: comm::Port<result::Result<~[u8], TcpErrData>>) ->
+             read_port: oldcomm::Port<result::Result<~[u8], TcpErrData>>) ->
     result::Result<(), TcpErrData> unsafe {
     log(debug, fmt!("taking the read_port out of commission %?", read_port));
     let socket_data = ptr::addr_of(&(*sock.socket_data));
@@ -484,13 +483,13 @@ pub fn accept(new_conn: TcpNewConnection)
       NewTcpConn(server_handle_ptr) => {
         let server_data_ptr = uv::ll::get_data_for_uv_handle(
             server_handle_ptr) as *TcpListenFcData;
-        let reader_po = core::comm::Port();
+        let reader_po = oldcomm::Port();
         let iotask = (*server_data_ptr).iotask;
         let stream_handle_ptr = malloc_uv_tcp_t();
         *(stream_handle_ptr as *mut uv::ll::uv_tcp_t) = uv::ll::tcp_t();
         let client_socket_data = @{
             reader_po: reader_po,
-            reader_ch: core::comm::Chan(&reader_po),
+            reader_ch: oldcomm::Chan(&reader_po),
             stream_handle_ptr : stream_handle_ptr,
             connect_req : uv::ll::connect_t(),
             write_req : uv::ll::write_t(),
@@ -501,8 +500,8 @@ pub fn accept(new_conn: TcpNewConnection)
         let client_stream_handle_ptr =
             (*client_socket_data_ptr).stream_handle_ptr;
 
-        let result_po = core::comm::Port::<Option<TcpErrData>>();
-        let result_ch = core::comm::Chan(&result_po);
+        let result_po = oldcomm::Port::<Option<TcpErrData>>();
+        let result_ch = oldcomm::Chan(&result_po);
 
         // UNSAFE LIBUV INTERACTION BEGIN
         // .. normally this happens within the context of
@@ -524,23 +523,23 @@ pub fn accept(new_conn: TcpNewConnection)
                 uv::ll::set_data_for_uv_handle(client_stream_handle_ptr,
                                                client_socket_data_ptr
                                                    as *libc::c_void);
-                core::comm::send(result_ch, None);
+                oldcomm::send(result_ch, None);
               }
               _ => {
                 log(debug, ~"failed to accept client conn");
-                core::comm::send(result_ch, Some(
+                oldcomm::send(result_ch, Some(
                     uv::ll::get_last_err_data(loop_ptr).to_tcp_err()));
               }
             }
           }
           _ => {
             log(debug, ~"failed to init client stream");
-            core::comm::send(result_ch, Some(
+            oldcomm::send(result_ch, Some(
                 uv::ll::get_last_err_data(loop_ptr).to_tcp_err()));
           }
         }
         // UNSAFE LIBUV INTERACTION END
-        match core::comm::recv(result_po) {
+        match oldcomm::recv(result_po) {
           Some(copy err_data) => result::Err(err_data),
           None => result::Ok(TcpSocket(client_socket_data))
         }
@@ -578,9 +577,9 @@ pub fn accept(new_conn: TcpNewConnection)
  */
 pub fn listen(host_ip: ip::IpAddr, port: uint, backlog: uint,
           iotask: IoTask,
-          on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
+          on_establish_cb: fn~(oldcomm::Chan<Option<TcpErrData>>),
           new_connect_cb: fn~(TcpNewConnection,
-                               comm::Chan<Option<TcpErrData>>))
+                               oldcomm::Chan<Option<TcpErrData>>))
     -> result::Result<(), TcpListenErrData> unsafe {
     do listen_common(move host_ip, port, backlog, iotask,
                      move on_establish_cb)
@@ -596,17 +595,17 @@ pub fn listen(host_ip: ip::IpAddr, port: uint, backlog: uint,
 
 fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint,
           iotask: IoTask,
-          on_establish_cb: fn~(comm::Chan<Option<TcpErrData>>),
+          on_establish_cb: fn~(oldcomm::Chan<Option<TcpErrData>>),
           on_connect_cb: fn~(*uv::ll::uv_tcp_t))
     -> result::Result<(), TcpListenErrData> unsafe {
-    let stream_closed_po = core::comm::Port::<()>();
-    let kill_po = core::comm::Port::<Option<TcpErrData>>();
-    let kill_ch = core::comm::Chan(&kill_po);
+    let stream_closed_po = oldcomm::Port::<()>();
+    let kill_po = oldcomm::Port::<Option<TcpErrData>>();
+    let kill_ch = oldcomm::Chan(&kill_po);
     let server_stream = uv::ll::tcp_t();
     let server_stream_ptr = ptr::addr_of(&server_stream);
     let server_data = {
         server_stream_ptr: server_stream_ptr,
-        stream_closed_ch: core::comm::Chan(&stream_closed_po),
+        stream_closed_ch: oldcomm::Chan(&stream_closed_po),
         kill_ch: kill_ch,
         on_connect_cb: move on_connect_cb,
         iotask: iotask,
@@ -618,7 +617,7 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint,
     };
     let server_data_ptr = ptr::addr_of(&server_data);
 
-    let setup_result = do core::comm::listen |setup_ch| {
+    let setup_result = do oldcomm::listen |setup_ch| {
         // this is to address a compiler warning about
         // an implicit copy.. it seems that double nested
         // will defeat a move sigil, as is done to the host_ip
@@ -652,25 +651,25 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint,
                     match uv::ll::listen(server_stream_ptr,
                                        backlog as libc::c_int,
                                        tcp_lfc_on_connection_cb) {
-                      0i32 => core::comm::send(setup_ch, None),
+                      0i32 => oldcomm::send(setup_ch, None),
                       _ => {
                         log(debug, ~"failure to uv_listen()");
                         let err_data = uv::ll::get_last_err_data(loop_ptr);
-                        core::comm::send(setup_ch, Some(err_data));
+                        oldcomm::send(setup_ch, Some(err_data));
                       }
                     }
                   }
                   _ => {
                     log(debug, ~"failure to uv_tcp_bind");
                     let err_data = uv::ll::get_last_err_data(loop_ptr);
-                    core::comm::send(setup_ch, Some(err_data));
+                    oldcomm::send(setup_ch, Some(err_data));
                   }
                 }
               }
               _ => {
                 log(debug, ~"failure to uv_tcp_init");
                 let err_data = uv::ll::get_last_err_data(loop_ptr);
-                core::comm::send(setup_ch, Some(err_data));
+                oldcomm::send(setup_ch, Some(err_data));
               }
             }
         };
@@ -704,7 +703,7 @@ fn listen_common(host_ip: ip::IpAddr, port: uint, backlog: uint,
       }
       None => {
         on_establish_cb(kill_ch);
-        let kill_result = core::comm::recv(kill_po);
+        let kill_result = oldcomm::recv(kill_po);
         do iotask::interact(iotask) |loop_ptr| unsafe {
             log(debug, fmt!("tcp::listen post-kill recv hl interact %?",
                             loop_ptr));
@@ -745,12 +744,12 @@ pub fn socket_buf(sock: TcpSocket) -> TcpSocketBuf {
 
 /// Convenience methods extending `net::tcp::tcp_socket`
 impl TcpSocket {
-    pub fn read_start() -> result::Result<comm::Port<
+    pub fn read_start() -> result::Result<oldcomm::Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> {
         read_start(&self)
     }
     pub fn read_stop(read_port:
-                 comm::Port<result::Result<~[u8], TcpErrData>>) ->
+                 oldcomm::Port<result::Result<~[u8], TcpErrData>>) ->
         result::Result<(), TcpErrData> {
         read_stop(&self, move read_port)
     }
@@ -877,8 +876,8 @@ fn get_type() -> io::WriterType {
 // INTERNAL API
 
 fn tear_down_socket_data(socket_data: @TcpSocketData) unsafe {
-    let closed_po = core::comm::Port::<()>();
-    let closed_ch = core::comm::Chan(&closed_po);
+    let closed_po = oldcomm::Port::<()>();
+    let closed_ch = oldcomm::Chan(&closed_po);
     let close_data = {
         closed_ch: closed_ch
     };
@@ -891,7 +890,7 @@ fn tear_down_socket_data(socket_data: @TcpSocketData) unsafe {
                                        close_data_ptr);
         uv::ll::close(stream_handle_ptr, tcp_socket_dtor_close_cb);
     };
-    core::comm::recv(closed_po);
+    oldcomm::recv(closed_po);
     //the line below will most likely crash
     //log(debug, fmt!("about to free socket_data at %?", socket_data));
     rustrt::rust_uv_current_kernel_free(stream_handle_ptr
@@ -915,7 +914,7 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
             timer::recv_timeout(
                iotask, timeout_msecs, result::get(&rs_result))
         } else {
-            Some(core::comm::recv(result::get(&rs_result)))
+            Some(oldcomm::recv(result::get(&rs_result)))
         };
         log(debug, ~"tcp::read after recv_timeout");
         match move read_result {
@@ -941,23 +940,23 @@ fn read_common_impl(socket_data: *TcpSocketData, timeout_msecs: uint)
 fn read_stop_common_impl(socket_data: *TcpSocketData) ->
     result::Result<(), TcpErrData> unsafe {
     let stream_handle_ptr = (*socket_data).stream_handle_ptr;
-    let stop_po = core::comm::Port::<Option<TcpErrData>>();
-    let stop_ch = core::comm::Chan(&stop_po);
+    let stop_po = oldcomm::Port::<Option<TcpErrData>>();
+    let stop_ch = oldcomm::Chan(&stop_po);
     do iotask::interact((*socket_data).iotask) |loop_ptr| unsafe {
         log(debug, ~"in interact cb for tcp::read_stop");
         match uv::ll::read_stop(stream_handle_ptr as *uv::ll::uv_stream_t) {
           0i32 => {
             log(debug, ~"successfully called uv_read_stop");
-            core::comm::send(stop_ch, None);
+            oldcomm::send(stop_ch, None);
           }
           _ => {
             log(debug, ~"failure in calling uv_read_stop");
             let err_data = uv::ll::get_last_err_data(loop_ptr);
-            core::comm::send(stop_ch, Some(err_data.to_tcp_err()));
+            oldcomm::send(stop_ch, Some(err_data.to_tcp_err()));
           }
         }
     };
-    match core::comm::recv(stop_po) {
+    match oldcomm::recv(stop_po) {
       Some(ref err_data) => result::Err(err_data.to_tcp_err()),
       None => result::Ok(())
     }
@@ -965,11 +964,11 @@ fn read_stop_common_impl(socket_data: *TcpSocketData) ->
 
 // shared impl for read_start
 fn read_start_common_impl(socket_data: *TcpSocketData)
-    -> result::Result<comm::Port<
+    -> result::Result<oldcomm::Port<
         result::Result<~[u8], TcpErrData>>, TcpErrData> unsafe {
     let stream_handle_ptr = (*socket_data).stream_handle_ptr;
-    let start_po = core::comm::Port::<Option<uv::ll::uv_err_data>>();
-    let start_ch = core::comm::Chan(&start_po);
+    let start_po = oldcomm::Port::<Option<uv::ll::uv_err_data>>();
+    let start_ch = oldcomm::Chan(&start_po);
     log(debug, ~"in tcp::read_start before interact loop");
     do iotask::interact((*socket_data).iotask) |loop_ptr| unsafe {
         log(debug, fmt!("in tcp::read_start interact cb %?", loop_ptr));
@@ -978,16 +977,16 @@ fn read_start_common_impl(socket_data: *TcpSocketData)
                                on_tcp_read_cb) {
           0i32 => {
             log(debug, ~"success doing uv_read_start");
-            core::comm::send(start_ch, None);
+            oldcomm::send(start_ch, None);
           }
           _ => {
             log(debug, ~"error attempting uv_read_start");
             let err_data = uv::ll::get_last_err_data(loop_ptr);
-            core::comm::send(start_ch, Some(err_data));
+            oldcomm::send(start_ch, Some(err_data));
           }
         }
     };
-    match core::comm::recv(start_po) {
+    match oldcomm::recv(start_po) {
       Some(ref err_data) => result::Err(err_data.to_tcp_err()),
       None => result::Ok((*socket_data).reader_po)
     }
@@ -1006,9 +1005,9 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData,
         vec::raw::to_ptr(raw_write_data),
         vec::len(raw_write_data)) ];
     let write_buf_vec_ptr = ptr::addr_of(&write_buf_vec);
-    let result_po = core::comm::Port::<TcpWriteResult>();
+    let result_po = oldcomm::Port::<TcpWriteResult>();
     let write_data = {
-        result_ch: core::comm::Chan(&result_po)
+        result_ch: oldcomm::Chan(&result_po)
     };
     let write_data_ptr = ptr::addr_of(&write_data);
     do iotask::interact((*socket_data_ptr).iotask) |loop_ptr| unsafe {
@@ -1024,7 +1023,7 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData,
           _ => {
             log(debug, ~"error invoking uv_write()");
             let err_data = uv::ll::get_last_err_data(loop_ptr);
-            core::comm::send((*write_data_ptr).result_ch,
+            oldcomm::send((*write_data_ptr).result_ch,
                        TcpWriteError(err_data.to_tcp_err()));
           }
         }
@@ -1033,7 +1032,7 @@ fn write_common_impl(socket_data_ptr: *TcpSocketData,
     // and waiting here for the write to complete, we should transfer
     // ownership of everything to the I/O task and let it deal with the
     // aftermath, so we don't have to sit here blocking.
-    match core::comm::recv(result_po) {
+    match oldcomm::recv(result_po) {
       TcpWriteSuccess => result::Ok(()),
       TcpWriteError(ref err_data) => result::Err(err_data.to_tcp_err())
     }
@@ -1045,8 +1044,8 @@ enum TcpNewConnection {
 
 type TcpListenFcData = {
     server_stream_ptr: *uv::ll::uv_tcp_t,
-    stream_closed_ch: comm::Chan<()>,
-    kill_ch: comm::Chan<Option<TcpErrData>>,
+    stream_closed_ch: oldcomm::Chan<()>,
+    kill_ch: oldcomm::Chan<Option<TcpErrData>>,
     on_connect_cb: fn~(*uv::ll::uv_tcp_t),
     iotask: IoTask,
     ipv6: bool,
@@ -1056,7 +1055,7 @@ enum TcpNewConnection {
 extern fn tcp_lfc_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
     let server_data_ptr = uv::ll::get_data_for_uv_handle(
         handle) as *TcpListenFcData;
-    core::comm::send((*server_data_ptr).stream_closed_ch, ());
+    oldcomm::send((*server_data_ptr).stream_closed_ch, ());
 }
 
 extern fn tcp_lfc_on_connection_cb(handle: *uv::ll::uv_tcp_t,
@@ -1069,7 +1068,7 @@ enum TcpNewConnection {
           0i32 => ((*server_data_ptr).on_connect_cb)(handle),
           _ => {
             let loop_ptr = uv::ll::get_loop_for_uv_handle(handle);
-            core::comm::send(kill_ch,
+            oldcomm::send(kill_ch,
                        Some(uv::ll::get_last_err_data(loop_ptr)
                             .to_tcp_err()));
             (*server_data_ptr).active = false;
@@ -1094,7 +1093,7 @@ enum TcpWriteResult {
 }
 
 enum TcpReadStartResult {
-    TcpReadStartSuccess(comm::Port<TcpReadResult>),
+    TcpReadStartSuccess(oldcomm::Port<TcpReadResult>),
     TcpReadStartError(TcpErrData)
 }
 
@@ -1129,7 +1128,7 @@ fn to_tcp_err() -> TcpErrData {
         log(debug, fmt!("on_tcp_read_cb: incoming err.. name %? msg %?",
                         err_data.err_name, err_data.err_msg));
         let reader_ch = (*socket_data_ptr).reader_ch;
-        core::comm::send(reader_ch, result::Err(err_data));
+        oldcomm::send(reader_ch, result::Err(err_data));
       }
       // do nothing .. unneeded buf
       0 => (),
@@ -1140,7 +1139,7 @@ fn to_tcp_err() -> TcpErrData {
         let reader_ch = (*socket_data_ptr).reader_ch;
         let buf_base = uv::ll::get_base_from_buf(buf);
         let new_bytes = vec::from_buf(buf_base, nread as uint);
-        core::comm::send(reader_ch, result::Ok(new_bytes));
+        oldcomm::send(reader_ch, result::Ok(new_bytes));
       }
     }
     uv::ll::free_base_of_buf(buf);
@@ -1160,14 +1159,14 @@ fn to_tcp_err() -> TcpErrData {
 }
 
 type TcpSocketCloseData = {
-    closed_ch: comm::Chan<()>
+    closed_ch: oldcomm::Chan<()>
 };
 
 extern fn tcp_socket_dtor_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
     let data = uv::ll::get_data_for_uv_handle(handle)
         as *TcpSocketCloseData;
     let closed_ch = (*data).closed_ch;
-    core::comm::send(closed_ch, ());
+    oldcomm::send(closed_ch, ());
     log(debug, ~"tcp_socket_dtor_close_cb exiting..");
 }
 
@@ -1177,31 +1176,31 @@ fn to_tcp_err() -> TcpErrData {
         as *WriteReqData;
     if status == 0i32 {
         log(debug, ~"successful write complete");
-        core::comm::send((*write_data_ptr).result_ch, TcpWriteSuccess);
+        oldcomm::send((*write_data_ptr).result_ch, TcpWriteSuccess);
     } else {
         let stream_handle_ptr = uv::ll::get_stream_handle_from_write_req(
             write_req);
         let loop_ptr = uv::ll::get_loop_for_uv_handle(stream_handle_ptr);
         let err_data = uv::ll::get_last_err_data(loop_ptr);
         log(debug, ~"failure to write");
-        core::comm::send((*write_data_ptr).result_ch,
+        oldcomm::send((*write_data_ptr).result_ch,
                          TcpWriteError(err_data));
     }
 }
 
 type WriteReqData = {
-    result_ch: comm::Chan<TcpWriteResult>
+    result_ch: oldcomm::Chan<TcpWriteResult>
 };
 
 type ConnectReqData = {
-    result_ch: comm::Chan<ConnAttempt>,
-    closed_signal_ch: comm::Chan<()>
+    result_ch: oldcomm::Chan<ConnAttempt>,
+    closed_signal_ch: oldcomm::Chan<()>
 };
 
 extern fn stream_error_close_cb(handle: *uv::ll::uv_tcp_t) unsafe {
     let data = uv::ll::get_data_for_uv_handle(handle) as
         *ConnectReqData;
-    core::comm::send((*data).closed_signal_ch, ());
+    oldcomm::send((*data).closed_signal_ch, ());
     log(debug, fmt!("exiting steam_error_close_cb for %?", handle));
 }
 
@@ -1220,7 +1219,7 @@ fn to_tcp_err() -> TcpErrData {
     match status {
       0i32 => {
         log(debug, ~"successful tcp connection!");
-        core::comm::send(result_ch, ConnSuccess);
+        oldcomm::send(result_ch, ConnSuccess);
       }
       _ => {
         log(debug, ~"error in tcp_connect_on_connect_cb");
@@ -1228,7 +1227,7 @@ fn to_tcp_err() -> TcpErrData {
         let err_data = uv::ll::get_last_err_data(loop_ptr);
         log(debug, fmt!("err_data %? %?", err_data.err_name,
                         err_data.err_msg));
-        core::comm::send(result_ch, ConnFailure(err_data));
+        oldcomm::send(result_ch, ConnFailure(err_data));
         uv::ll::set_data_for_uv_handle(tcp_stream_ptr,
                                        conn_data_ptr);
         uv::ll::close(tcp_stream_ptr, stream_error_close_cb);
@@ -1243,8 +1242,8 @@ enum ConnAttempt {
 }
 
 type TcpSocketData = {
-    reader_po: comm::Port<result::Result<~[u8], TcpErrData>>,
-    reader_ch: comm::Chan<result::Result<~[u8], TcpErrData>>,
+    reader_po: oldcomm::Port<result::Result<~[u8], TcpErrData>>,
+    reader_ch: oldcomm::Chan<result::Result<~[u8], TcpErrData>>,
     stream_handle_ptr: *uv::ll::uv_tcp_t,
     connect_req: uv::ll::uv_connect_t,
     write_req: uv::ll::uv_write_t,
@@ -1337,14 +1336,14 @@ fn impl_gl_tcp_ipv4_server_and_client() {
         let expected_req = ~"ping";
         let expected_resp = ~"pong";
 
-        let server_result_po = core::comm::Port::<~str>();
-        let server_result_ch = core::comm::Chan(&server_result_po);
+        let server_result_po = oldcomm::Port::<~str>();
+        let server_result_ch = oldcomm::Chan(&server_result_po);
 
-        let cont_po = core::comm::Port::<()>();
-        let cont_ch = core::comm::Chan(&cont_po);
+        let cont_po = oldcomm::Port::<()>();
+        let cont_ch = oldcomm::Chan(&cont_po);
         // server
         do task::spawn_sched(task::ManualThreads(1u)) {
-            let actual_req = do comm::listen |server_ch| {
+            let actual_req = do oldcomm::listen |server_ch| {
                 run_tcp_test_server(
                     server_ip,
                     server_port,
@@ -1355,10 +1354,10 @@ fn impl_gl_tcp_ipv4_server_and_client() {
             };
             server_result_ch.send(actual_req);
         };
-        core::comm::recv(cont_po);
+        oldcomm::recv(cont_po);
         // client
         log(debug, ~"server started, firing up client..");
-        let actual_resp_result = do core::comm::listen |client_ch| {
+        let actual_resp_result = do oldcomm::listen |client_ch| {
             run_tcp_test_client(
                 server_ip,
                 server_port,
@@ -1368,7 +1367,7 @@ fn impl_gl_tcp_ipv4_server_and_client() {
         };
         assert actual_resp_result.is_ok();
         let actual_resp = actual_resp_result.get();
-        let actual_req = core::comm::recv(server_result_po);
+        let actual_req = oldcomm::recv(server_result_po);
         log(debug, fmt!("REQ: expected: '%s' actual: '%s'",
                        expected_req, actual_req));
         log(debug, fmt!("RESP: expected: '%s' actual: '%s'",
@@ -1382,14 +1381,14 @@ fn impl_gl_tcp_ipv4_get_peer_addr() {
         let server_port = 8887u;
         let expected_resp = ~"pong";
 
-        let server_result_po = core::comm::Port::<~str>();
-        let server_result_ch = core::comm::Chan(&server_result_po);
+        let server_result_po = oldcomm::Port::<~str>();
+        let server_result_ch = oldcomm::Chan(&server_result_po);
 
-        let cont_po = core::comm::Port::<()>();
-        let cont_ch = core::comm::Chan(&cont_po);
+        let cont_po = oldcomm::Port::<()>();
+        let cont_ch = oldcomm::Chan(&cont_po);
         // server
         do task::spawn_sched(task::ManualThreads(1u)) {
-            let actual_req = do comm::listen |server_ch| {
+            let actual_req = do oldcomm::listen |server_ch| {
                 run_tcp_test_server(
                     server_ip,
                     server_port,
@@ -1400,10 +1399,10 @@ fn impl_gl_tcp_ipv4_get_peer_addr() {
             };
             server_result_ch.send(actual_req);
         };
-        core::comm::recv(cont_po);
+        oldcomm::recv(cont_po);
         // client
         log(debug, ~"server started, firing up client..");
-        do core::comm::listen |client_ch| {
+        do oldcomm::listen |client_ch| {
             let server_ip_addr = ip::v4::parse_addr(server_ip);
             let iotask = uv::global_loop::get();
             let connect_result = connect(move server_ip_addr, server_port,
@@ -1430,7 +1429,7 @@ fn impl_gl_tcp_ipv4_client_error_connection_refused() {
         let expected_req = ~"ping";
         // client
         log(debug, ~"firing up client..");
-        let actual_resp_result = do core::comm::listen |client_ch| {
+        let actual_resp_result = do oldcomm::listen |client_ch| {
             run_tcp_test_client(
                 server_ip,
                 server_port,
@@ -1450,14 +1449,14 @@ fn impl_gl_tcp_ipv4_server_address_in_use() {
         let expected_req = ~"ping";
         let expected_resp = ~"pong";
 
-        let server_result_po = core::comm::Port::<~str>();
-        let server_result_ch = core::comm::Chan(&server_result_po);
+        let server_result_po = oldcomm::Port::<~str>();
+        let server_result_ch = oldcomm::Chan(&server_result_po);
 
-        let cont_po = core::comm::Port::<()>();
-        let cont_ch = core::comm::Chan(&cont_po);
+        let cont_po = oldcomm::Port::<()>();
+        let cont_ch = oldcomm::Chan(&cont_po);
         // server
         do task::spawn_sched(task::ManualThreads(1u)) {
-            let actual_req = do comm::listen |server_ch| {
+            let actual_req = do oldcomm::listen |server_ch| {
                 run_tcp_test_server(
                     server_ip,
                     server_port,
@@ -1468,7 +1467,7 @@ fn impl_gl_tcp_ipv4_server_address_in_use() {
             };
             server_result_ch.send(actual_req);
         };
-        core::comm::recv(cont_po);
+        oldcomm::recv(cont_po);
         // this one should fail..
         let listen_err = run_tcp_test_server_fail(
                             server_ip,
@@ -1476,7 +1475,7 @@ fn impl_gl_tcp_ipv4_server_address_in_use() {
                             hl_loop);
         // client.. just doing this so that the first server tears down
         log(debug, ~"server started, firing up client..");
-        do core::comm::listen |client_ch| {
+        do oldcomm::listen |client_ch| {
             run_tcp_test_client(
                 server_ip,
                 server_port,
@@ -1574,14 +1573,14 @@ fn impl_tcp_socket_impl_reader_handles_eof() {
         let expected_req = ~"GET /";
         let expected_resp = ~"A string\nwith multiple lines\n";
 
-        let server_result_po = core::comm::Port::<~str>();
-        let server_result_ch = core::comm::Chan(&server_result_po);
+        let server_result_po = oldcomm::Port::<~str>();
+        let server_result_ch = oldcomm::Chan(&server_result_po);
 
-        let cont_po = core::comm::Port::<()>();
-        let cont_ch = core::comm::Chan(&cont_po);
+        let cont_po = oldcomm::Port::<()>();
+        let cont_ch = oldcomm::Chan(&cont_po);
         // server
         do task::spawn_sched(task::ManualThreads(1u)) {
-            let actual_req = do comm::listen |server_ch| {
+            let actual_req = do oldcomm::listen |server_ch| {
                 run_tcp_test_server(
                     server_ip,
                     server_port,
@@ -1592,7 +1591,7 @@ fn impl_tcp_socket_impl_reader_handles_eof() {
             };
             server_result_ch.send(actual_req);
         };
-        core::comm::recv(cont_po);
+        oldcomm::recv(cont_po);
         // client
         log(debug, ~"server started, firing up client..");
         let server_addr = ip::v4::parse_addr(server_ip);
@@ -1626,8 +1625,8 @@ fn buf_read<R:io::Reader>(r: &R, len: uint) -> ~str {
     }
 
     fn run_tcp_test_server(server_ip: &str, server_port: uint, resp: ~str,
-                          server_ch: comm::Chan<~str>,
-                          cont_ch: comm::Chan<()>,
+                          server_ch: oldcomm::Chan<~str>,
+                          cont_ch: oldcomm::Chan<()>,
                           iotask: IoTask) -> ~str {
         let server_ip_addr = ip::v4::parse_addr(server_ip);
         let listen_result = listen(move server_ip_addr, server_port, 128,
@@ -1636,13 +1635,13 @@ fn run_tcp_test_server(server_ip: &str, server_port: uint, resp: ~str,
             |kill_ch| {
                 log(debug, fmt!("establish_cb %?",
                     kill_ch));
-                core::comm::send(cont_ch, ());
+                oldcomm::send(cont_ch, ());
             },
             // risky to run this on the loop, but some users
             // will want the POWER
             |new_conn, kill_ch| {
             log(debug, ~"SERVER: new connection!");
-            do comm::listen |cont_ch| {
+            do oldcomm::listen |cont_ch| {
                 do task::spawn_sched(task::ManualThreads(1u)) {
                     log(debug, ~"SERVER: starting worker for new req");
 
@@ -1651,7 +1650,7 @@ fn run_tcp_test_server(server_ip: &str, server_port: uint, resp: ~str,
                     if result::is_err(&accept_result) {
                         log(debug, ~"SERVER: error accept connection");
                         let err_data = result::get_err(&accept_result);
-                        core::comm::send(kill_ch, Some(err_data));
+                        oldcomm::send(kill_ch, Some(err_data));
                         log(debug,
                             ~"SERVER/WORKER: send on err cont ch");
                         cont_ch.send(());
@@ -1677,12 +1676,12 @@ fn run_tcp_test_server(server_ip: &str, server_port: uint, resp: ~str,
                             log(debug, ~"SERVER: before write");
                             tcp_write_single(&sock, str::to_bytes(resp));
                             log(debug, ~"SERVER: after write.. die");
-                            core::comm::send(kill_ch, None);
+                            oldcomm::send(kill_ch, None);
                           }
                           result::Err(move err_data) => {
                             log(debug, fmt!("SERVER: error recvd: %s %s",
                                 err_data.err_name, err_data.err_msg));
-                            core::comm::send(kill_ch, Some(err_data));
+                            oldcomm::send(kill_ch, Some(err_data));
                             server_ch.send(~"");
                           }
                         }
@@ -1738,7 +1737,7 @@ fn run_tcp_test_server_fail(server_ip: &str, server_port: uint,
     }
 
     fn run_tcp_test_client(server_ip: &str, server_port: uint, resp: &str,
-                          client_ch: comm::Chan<~str>,
+                          client_ch: oldcomm::Chan<~str>,
                           iotask: IoTask) -> result::Result<~str,
                                                     TcpConnectErrData> {
         let server_ip_addr = ip::v4::parse_addr(server_ip);
index 2bf735dd584e9c5adebf080d12692bffbf1153d8..d365077d0639d40a638d5e07efa7dfca7693ac8a 100644 (file)
@@ -23,7 +23,6 @@
 use io::WriterUtil;
 use libc::size_t;
 use task::TaskBuilder;
-use comm = core::comm;
 
 #[abi = "cdecl"]
 extern mod rustrt {
@@ -289,8 +288,8 @@ fn run_tests(opts: &TestOpts, tests: &[TestDesc],
     let mut wait_idx = 0;
     let mut done_idx = 0;
 
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
 
     while done_idx < total {
         while wait_idx < concurrency && run_idx < total {
@@ -306,7 +305,7 @@ fn run_tests(opts: &TestOpts, tests: &[TestDesc],
             run_idx += 1;
         }
 
-        let (test, result) = core::comm::recv(p);
+        let (test, result) = oldcomm::recv(p);
         if concurrency != 1 {
             callback(TeWait(copy test));
         }
@@ -383,9 +382,9 @@ fn filter(test: &TestDesc) -> Option<TestDesc> {
 
 type TestFuture = {test: TestDesc, wait: fn@() -> TestResult};
 
-fn run_test(test: TestDesc, monitor_ch: comm::Chan<MonitorMsg>) {
+fn run_test(test: TestDesc, monitor_ch: oldcomm::Chan<MonitorMsg>) {
     if test.ignore {
-        core::comm::send(monitor_ch, (copy test, TrIgnored));
+        oldcomm::send(monitor_ch, (copy test, TrIgnored));
         return;
     }
 
@@ -397,7 +396,7 @@ fn run_test(test: TestDesc, monitor_ch: comm::Chan<MonitorMsg>) {
         }).spawn(move testfn);
         let task_result = option::unwrap(move result_future).recv();
         let test_result = calc_result(&test, task_result == task::Success);
-        comm::send(monitor_ch, (copy test, test_result));
+        oldcomm::send(monitor_ch, (copy test, test_result));
     };
 }
 
@@ -424,10 +423,10 @@ fn do_not_run_ignored_tests() {
             ignore: true,
             should_fail: false
         };
-        let p = core::comm::Port();
-        let ch = core::comm::Chan(&p);
+        let p = oldcomm::Port();
+        let ch = oldcomm::Chan(&p);
         run_test(desc, ch);
-        let (_, res) = core::comm::recv(p);
+        let (_, res) = oldcomm::recv(p);
         assert res != TrOk;
     }
 
@@ -440,10 +439,10 @@ fn f() { }
             ignore: true,
             should_fail: false
         };
-        let p = core::comm::Port();
-        let ch = core::comm::Chan(&p);
+        let p = oldcomm::Port();
+        let ch = oldcomm::Chan(&p);
         run_test(desc, ch);
-        let (_, res) = core::comm::recv(p);
+        let (_, res) = oldcomm::recv(p);
         assert res == TrIgnored;
     }
 
@@ -457,10 +456,10 @@ fn test_should_fail() {
             ignore: false,
             should_fail: true
         };
-        let p = core::comm::Port();
-        let ch = core::comm::Chan(&p);
+        let p = oldcomm::Port();
+        let ch = oldcomm::Chan(&p);
         run_test(desc, ch);
-        let (_, res) = core::comm::recv(p);
+        let (_, res) = oldcomm::recv(p);
         assert res == TrOk;
     }
 
@@ -473,10 +472,10 @@ fn f() { }
             ignore: false,
             should_fail: true
         };
-        let p = core::comm::Port();
-        let ch = core::comm::Chan(&p);
+        let p = oldcomm::Port();
+        let ch = oldcomm::Chan(&p);
         run_test(desc, ch);
-        let (_, res) = core::comm::recv(p);
+        let (_, res) = oldcomm::recv(p);
         assert res == TrFailed;
     }
 
index a9638ad05c37fdb4b9c4b6d7aa8cec19e71ae9a2..c3a2a11e1f840df1e7549da56679f8560e99cc92 100644 (file)
@@ -14,7 +14,6 @@
 
 use uv::iotask;
 use uv::iotask::IoTask;
-use comm = core::comm;
 
 /**
  * Wait for timeout period then send provided value over a channel
  * * val - a value of type T to send over the provided `ch`
  */
 pub fn delayed_send<T: Owned>(iotask: IoTask,
-                                  msecs: uint, ch: comm::Chan<T>, val: T) {
+                                  msecs: uint, ch: oldcomm::Chan<T>, val: T) {
         unsafe {
-            let timer_done_po = core::comm::Port::<()>();
-            let timer_done_ch = core::comm::Chan(&timer_done_po);
+            let timer_done_po = oldcomm::Port::<()>();
+            let timer_done_ch = oldcomm::Chan(&timer_done_po);
             let timer_done_ch_ptr = ptr::addr_of(&timer_done_ch);
             let timer = uv::ll::timer_t();
             let timer_ptr = ptr::addr_of(&timer);
@@ -62,11 +61,11 @@ pub fn delayed_send<T: Owned>(iotask: IoTask,
                 }
             };
             // delayed_send_cb has been processed by libuv
-            core::comm::recv(timer_done_po);
+            oldcomm::recv(timer_done_po);
             // notify the caller immediately
-            core::comm::send(ch, move(val));
+            oldcomm::send(ch, move(val));
             // uv_close for this timer has been processed
-            core::comm::recv(timer_done_po);
+            oldcomm::recv(timer_done_po);
     };
 }
 
@@ -82,10 +81,10 @@ pub fn delayed_send<T: Owned>(iotask: IoTask,
  * * msecs - an amount of time, in milliseconds, for the current task to block
  */
 pub fn sleep(iotask: IoTask, msecs: uint) {
-    let exit_po = core::comm::Port::<()>();
-    let exit_ch = core::comm::Chan(&exit_po);
+    let exit_po = oldcomm::Port::<()>();
+    let exit_ch = oldcomm::Chan(&exit_po);
     delayed_send(iotask, msecs, exit_ch, ());
-    core::comm::recv(exit_po);
+    oldcomm::recv(exit_po);
 }
 
 /**
@@ -110,9 +109,9 @@ pub fn sleep(iotask: IoTask, msecs: uint) {
  */
 pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
                               msecs: uint,
-                              wait_po: comm::Port<T>) -> Option<T> {
-    let timeout_po = comm::Port::<()>();
-    let timeout_ch = comm::Chan(&timeout_po);
+                              wait_po: oldcomm::Port<T>) -> Option<T> {
+    let timeout_po = oldcomm::Port::<()>();
+    let timeout_ch = oldcomm::Chan(&timeout_po);
     delayed_send(iotask, msecs, timeout_ch, ());
     // FIXME: This could be written clearer (#2618)
     either::either(
@@ -122,7 +121,7 @@ pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
             None
         }, |right_val| {
             Some(*right_val)
-        }, &core::comm::select2(timeout_po, wait_po)
+        }, &oldcomm::select2(timeout_po, wait_po)
     )
 }
 
@@ -131,10 +130,10 @@ pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
                                 status: libc::c_int) unsafe {
     log(debug, fmt!("delayed_send_cb handle %? status %?", handle, status));
     let timer_done_ch =
-        *(uv::ll::get_data_for_uv_handle(handle) as *comm::Chan<()>);
+        *(uv::ll::get_data_for_uv_handle(handle) as *oldcomm::Chan<()>);
     let stop_result = uv::ll::timer_stop(handle);
     if (stop_result == 0i32) {
-        core::comm::send(timer_done_ch, ());
+        oldcomm::send(timer_done_ch, ());
         uv::ll::close(handle, delayed_send_close_cb);
     }
     else {
@@ -147,8 +146,8 @@ pub fn recv_timeout<T: Copy Owned>(iotask: IoTask,
 extern fn delayed_send_close_cb(handle: *uv::ll::uv_timer_t) unsafe {
     log(debug, fmt!("delayed_send_close_cb handle %?", handle));
     let timer_done_ch =
-        *(uv::ll::get_data_for_uv_handle(handle) as *comm::Chan<()>);
-    comm::send(timer_done_ch, ());
+        *(uv::ll::get_data_for_uv_handle(handle) as *oldcomm::Chan<()>);
+    oldcomm::send(timer_done_ch, ());
 }
 
 #[cfg(test)]
@@ -170,8 +169,8 @@ fn test_gl_timer_sleep_stress1() {
 
     #[test]
     fn test_gl_timer_sleep_stress2() {
-        let po = core::comm::Port();
-        let ch = core::comm::Chan(&po);
+        let po = oldcomm::Port();
+        let ch = oldcomm::Chan(&po);
         let hl_loop = uv::global_loop::get();
 
         let repeat = 20u;
@@ -193,13 +192,13 @@ fn test_gl_timer_sleep_stress2() {
                     for iter::repeat(times) {
                         sleep(hl_loop, rng.next() as uint % maxms);
                     }
-                    core::comm::send(ch, ());
+                    oldcomm::send(ch, ());
                 }
             }
         }
 
         for iter::repeat(repeat * spec.len()) {
-            core::comm::recv(po)
+            oldcomm::recv(po)
         }
     }
 
@@ -248,8 +247,8 @@ fn test_gl_timer_recv_timeout_after_time_passes() {
 
         for iter::repeat(times as uint) {
             let expected = rand::Rng().gen_str(16u);
-            let test_po = core::comm::Port::<~str>();
-            let test_ch = core::comm::Chan(&test_po);
+            let test_po = oldcomm::Port::<~str>();
+            let test_ch = oldcomm::Chan(&test_po);
 
             do task::spawn() {
                 delayed_send(hl_loop, 50u, test_ch, expected);
index 58b9a8d3d944528175711ca80b02cc6852a56348..2efbfae3da4e26ee5d8f697de0a299c5b7641747 100644 (file)
@@ -17,8 +17,7 @@
 use get_gl = get;
 use uv_iotask::{IoTask, spawn_iotask};
 use private::{chan_from_global_ptr, weaken_task};
-use comm = core::comm;
-use core::comm::{Port, Chan, select2, listen};
+use core::oldcomm::{Port, Chan, select2, listen};
 use task::TaskBuilder;
 use either::{Left, Right};
 
@@ -121,9 +120,9 @@ fn spawn_loop() -> IoTask {
 mod test {
     extern fn simple_timer_close_cb(timer_ptr: *ll::uv_timer_t) unsafe {
         let exit_ch_ptr = ll::get_data_for_uv_handle(
-            timer_ptr as *libc::c_void) as *comm::Chan<bool>;
+            timer_ptr as *libc::c_void) as *oldcomm::Chan<bool>;
         let exit_ch = *exit_ch_ptr;
-        core::comm::send(exit_ch, true);
+        oldcomm::send(exit_ch, true);
         log(debug, fmt!("EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?",
                        exit_ch_ptr));
     }
@@ -142,8 +141,8 @@ mod test {
     }
 
     fn impl_uv_hl_simple_timer(iotask: IoTask) unsafe {
-        let exit_po = core::comm::Port::<bool>();
-        let exit_ch = core::comm::Chan(&exit_po);
+        let exit_po = oldcomm::Port::<bool>();
+        let exit_ch = oldcomm::Chan(&exit_po);
         let exit_ch_ptr = ptr::addr_of(&exit_ch);
         log(debug, fmt!("EXIT_CH_PTR newly created exit_ch_ptr: %?",
                        exit_ch_ptr));
@@ -168,21 +167,21 @@ fn impl_uv_hl_simple_timer(iotask: IoTask) unsafe {
                 fail ~"failure on ll::timer_init()";
             }
         };
-        core::comm::recv(exit_po);
+        oldcomm::recv(exit_po);
         log(debug, ~"global_loop timer test: msg recv on exit_po, done..");
     }
 
     #[test]
     fn test_gl_uv_global_loop_high_level_global_timer() unsafe {
         let hl_loop = get_gl();
-        let exit_po = comm::Port::<()>();
-        let exit_ch = comm::Chan(&exit_po);
+        let exit_po = oldcomm::Port::<()>();
+        let exit_ch = oldcomm::Chan(&exit_po);
         task::spawn_sched(task::ManualThreads(1u), || {
             impl_uv_hl_simple_timer(hl_loop);
-            core::comm::send(exit_ch, ());
+            oldcomm::send(exit_ch, ());
         });
         impl_uv_hl_simple_timer(hl_loop);
-        core::comm::recv(exit_po);
+        oldcomm::recv(exit_po);
     }
 
     // keeping this test ignored until some kind of stress-test-harness
@@ -191,17 +190,17 @@ fn test_gl_uv_global_loop_high_level_global_timer() unsafe {
     #[ignore]
     fn test_stress_gl_uv_global_loop_high_level_global_timer() unsafe {
         let hl_loop = get_gl();
-        let exit_po = core::comm::Port::<()>();
-        let exit_ch = core::comm::Chan(&exit_po);
+        let exit_po = oldcomm::Port::<()>();
+        let exit_ch = oldcomm::Chan(&exit_po);
         let cycles = 5000u;
         for iter::repeat(cycles) {
             task::spawn_sched(task::ManualThreads(1u), || {
                 impl_uv_hl_simple_timer(hl_loop);
-                core::comm::send(exit_ch, ());
+                oldcomm::send(exit_ch, ());
             });
         };
         for iter::repeat(cycles) {
-            core::comm::recv(exit_po);
+            oldcomm::recv(exit_po);
         };
         log(debug, ~"test_stress_gl_uv_global_loop_high_level_global_timer"+
             ~" exiting sucessfully!");
index 19f5997a57d7342515a6207b25e63a5941632406..d778606075d1a122dd6cf1b02575829414cf0e31 100644 (file)
@@ -18,8 +18,7 @@
 
 use libc::c_void;
 use ptr::addr_of;
-use comm = core::comm;
-use core::comm::{Port, Chan, listen};
+use core::oldcomm::{Port, Chan, listen};
 use task::TaskBuilder;
 use ll = uv_ll;
 
@@ -178,7 +177,7 @@ mod test {
         log(debug, fmt!("async_close_cb handle %?", handle));
         let exit_ch = (*(ll::get_data_for_uv_handle(handle)
                         as *AhData)).exit_ch;
-        core::comm::send(exit_ch, ());
+        oldcomm::send(exit_ch, ());
     }
     extern fn async_handle_cb(handle: *ll::uv_async_t, status: libc::c_int)
         unsafe {
@@ -187,13 +186,13 @@ mod test {
     }
     type AhData = {
         iotask: IoTask,
-        exit_ch: comm::Chan<()>
+        exit_ch: oldcomm::Chan<()>
     };
     fn impl_uv_iotask_async(iotask: IoTask) unsafe {
         let async_handle = ll::async_t();
         let ah_ptr = ptr::addr_of(&async_handle);
-        let exit_po = core::comm::Port::<()>();
-        let exit_ch = core::comm::Chan(&exit_po);
+        let exit_po = oldcomm::Port::<()>();
+        let exit_ch = oldcomm::Chan(&exit_po);
         let ah_data = {
             iotask: iotask,
             exit_ch: exit_ch
@@ -204,19 +203,19 @@ fn impl_uv_iotask_async(iotask: IoTask) unsafe {
             ll::set_data_for_uv_handle(ah_ptr, ah_data_ptr as *libc::c_void);
             ll::async_send(ah_ptr);
         };
-        core::comm::recv(exit_po);
+        oldcomm::recv(exit_po);
     }
 
     // this fn documents the bear minimum neccesary to roll your own
     // high_level_loop
-    unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> IoTask {
-        let iotask_port = comm::Port::<IoTask>();
-        let iotask_ch = comm::Chan(&iotask_port);
+    unsafe fn spawn_test_loop(exit_ch: oldcomm::Chan<()>) -> IoTask {
+        let iotask_port = oldcomm::Port::<IoTask>();
+        let iotask_ch = oldcomm::Chan(&iotask_port);
         do task::spawn_sched(task::ManualThreads(1u)) {
             run_loop(iotask_ch);
             exit_ch.send(());
         };
-        return core::comm::recv(iotask_port);
+        return oldcomm::recv(iotask_port);
     }
 
     extern fn lifetime_handle_close(handle: *libc::c_void) unsafe {
@@ -231,8 +230,8 @@ unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> IoTask {
 
     #[test]
     fn test_uv_iotask_async() unsafe {
-        let exit_po = core::comm::Port::<()>();
-        let exit_ch = core::comm::Chan(&exit_po);
+        let exit_po = oldcomm::Port::<()>();
+        let exit_ch = oldcomm::Chan(&exit_po);
         let iotask = spawn_test_loop(exit_ch);
 
         // using this handle to manage the lifetime of the high_level_loop,
@@ -241,20 +240,20 @@ fn test_uv_iotask_async() unsafe {
         // under race-condition type situations.. this ensures that the loop
         // lives until, at least, all of the impl_uv_hl_async() runs have been
         // called, at least.
-        let work_exit_po = core::comm::Port::<()>();
-        let work_exit_ch = core::comm::Chan(&work_exit_po);
+        let work_exit_po = oldcomm::Port::<()>();
+        let work_exit_ch = oldcomm::Chan(&work_exit_po);
         for iter::repeat(7u) {
             do task::spawn_sched(task::ManualThreads(1u)) {
                 impl_uv_iotask_async(iotask);
-                core::comm::send(work_exit_ch, ());
+                oldcomm::send(work_exit_ch, ());
             };
         };
         for iter::repeat(7u) {
-            core::comm::recv(work_exit_po);
+            oldcomm::recv(work_exit_po);
         };
         log(debug, ~"sending teardown_loop msg..");
         exit(iotask);
-        core::comm::recv(exit_po);
+        oldcomm::recv(exit_po);
         log(debug, ~"after recv on exit_po.. exiting..");
     }
 }
index d52adbc78739501c5c81d230251154690753812e..65333b41864e52813d01913622b18bfbeef24226 100644 (file)
@@ -33,7 +33,6 @@
 #[allow(non_camel_case_types)]; // C types
 
 use libc::size_t;
-use comm = core::comm;
 use ptr::to_unsafe_ptr;
 
 // libuv struct mappings
@@ -1045,7 +1044,7 @@ enum tcp_read_data {
     type request_wrapper = {
         write_req: *uv_write_t,
         req_buf: *~[uv_buf_t],
-        read_chan: *comm::Chan<~str>
+        read_chan: *oldcomm::Chan<~str>
     };
 
     extern fn after_close_cb(handle: *libc::c_void) {
@@ -1083,7 +1082,7 @@ enum tcp_read_data {
             let bytes = vec::from_buf(buf_base, buf_len as uint);
             let read_chan = *((*client_data).read_chan);
             let msg_from_server = str::from_bytes(bytes);
-            core::comm::send(read_chan, msg_from_server);
+            oldcomm::send(read_chan, msg_from_server);
             close(stream as *libc::c_void, after_close_cb)
         }
         else if (nread == -1) {
@@ -1143,7 +1142,7 @@ enum tcp_read_data {
     }
 
     fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
-                          client_chan: *comm::Chan<~str>) unsafe {
+                          client_chan: *oldcomm::Chan<~str>) unsafe {
         let test_loop = loop_new();
         let tcp_handle = tcp_t();
         let tcp_handle_ptr = ptr::addr_of(&tcp_handle);
@@ -1268,7 +1267,7 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
                 log(debug, ~"SERVER: sending response to client");
                 read_stop(client_stream_ptr);
                 let server_chan = *((*client_data).server_chan);
-                core::comm::send(server_chan, request_str);
+                oldcomm::send(server_chan, request_str);
                 let write_result = write(
                     write_req,
                     client_stream_ptr as *libc::c_void,
@@ -1360,12 +1359,12 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
         server: *uv_tcp_t,
         server_kill_msg: ~str,
         server_resp_buf: *~[uv_buf_t],
-        server_chan: *comm::Chan<~str>,
+        server_chan: *oldcomm::Chan<~str>,
         server_write_req: *uv_write_t
     };
 
     type async_handle_data = {
-        continue_chan: *comm::Chan<bool>
+        continue_chan: *oldcomm::Chan<bool>
     };
 
     extern fn async_close_cb(handle: *libc::c_void) {
@@ -1383,7 +1382,7 @@ fn impl_uv_tcp_request(ip: &str, port: int, req_str: &str,
             async_handle as *libc::c_void) as *async_handle_data;
         let continue_chan = *((*data).continue_chan);
         let should_continue = status == 0i32;
-        core::comm::send(continue_chan, should_continue);
+        oldcomm::send(continue_chan, should_continue);
         close(async_handle as *libc::c_void, async_close_cb);
     }
 
@@ -1391,8 +1390,8 @@ fn impl_uv_tcp_server(server_ip: &str,
                           server_port: int,
                           +kill_server_msg: ~str,
                           +server_resp_msg: ~str,
-                          server_chan: *comm::Chan<~str>,
-                          continue_chan: *comm::Chan<bool>) unsafe {
+                          server_chan: *oldcomm::Chan<~str>,
+                          continue_chan: *oldcomm::Chan<bool>) unsafe {
         let test_loop = loop_new();
         let tcp_server = tcp_t();
         let tcp_server_ptr = ptr::addr_of(&tcp_server);
@@ -1497,13 +1496,13 @@ fn impl_uv_tcp_server_and_request() unsafe {
         let port = 8886;
         let kill_server_msg = ~"does a dog have buddha nature?";
         let server_resp_msg = ~"mu!";
-        let client_port = core::comm::Port::<~str>();
-        let client_chan = core::comm::Chan::<~str>(&client_port);
-        let server_port = core::comm::Port::<~str>();
-        let server_chan = core::comm::Chan::<~str>(&server_port);
+        let client_port = oldcomm::Port::<~str>();
+        let client_chan = oldcomm::Chan::<~str>(&client_port);
+        let server_port = oldcomm::Port::<~str>();
+        let server_chan = oldcomm::Chan::<~str>(&server_port);
 
-        let continue_port = core::comm::Port::<bool>();
-        let continue_chan = core::comm::Chan::<bool>(&continue_port);
+        let continue_port = oldcomm::Port::<bool>();
+        let continue_chan = oldcomm::Chan::<bool>(&continue_port);
         let continue_chan_ptr = ptr::addr_of(&continue_chan);
 
         do task::spawn_sched(task::ManualThreads(1)) {
@@ -1516,7 +1515,7 @@ fn impl_uv_tcp_server_and_request() unsafe {
 
         // block until the server up is.. possibly a race?
         log(debug, ~"before receiving on server continue_port");
-        core::comm::recv(continue_port);
+        oldcomm::recv(continue_port);
         log(debug, ~"received on continue port, set up tcp client");
 
         do task::spawn_sched(task::ManualThreads(1u)) {
@@ -1525,8 +1524,8 @@ fn impl_uv_tcp_server_and_request() unsafe {
                                ptr::addr_of(&client_chan));
         };
 
-        let msg_from_client = core::comm::recv(server_port);
-        let msg_from_server = core::comm::recv(client_port);
+        let msg_from_client = oldcomm::recv(server_port);
+        let msg_from_server = oldcomm::recv(client_port);
 
         assert str::contains(msg_from_client, kill_server_msg);
         assert str::contains(msg_from_server, server_resp_msg);
index 67dc05bc31d154054f5694ba2d88886142539a18..a558de338762917ae6b336f5e53c48244592fc35 100644 (file)
@@ -12,7 +12,7 @@
 
 export foo;
 
-use core::comm::*;
+use core::oldcomm::*;
 
 fn foo<T: Owned Copy>(x: T) -> Port<T> {
     let p = Port();
index d8ce8076e41ed47109b2d51285573038acdcf423..0ae2dc5340e276036cde646895e6e0712e8f436d 100644 (file)
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 /*
-  Minimized version of core::comm for testing. 
+  Minimized version of core::oldcomm for testing. 
 
   Could probably be more minimal.
  */
@@ -22,7 +22,7 @@
 
 
 /**
- * A communication endpoint that can receive messages
+ * A oldcommunication endpoint that can receive messages
  *
  * Each port has a unique per-task identity and may not be replicated or
  * transmitted. If a port value is copied, both copies refer to the same
index a40c87aa3f18dc4d3991b42ad0688204978913ae..774e0b2e53a7a56828026f69558127e4cd294a3b 100644 (file)
@@ -26,7 +26,7 @@
 use std::deque::Deque;
 use std::par;
 use io::WriterUtil;
-use comm::*;
+use oldcomm::*;
 use int::abs;
 
 type node_id = i64;
index e51cb7bab144d8a4ee8fe219d223cd6c00660237..62226a1c44de1b6b1c5a531995c9342a687de047 100644 (file)
@@ -14,7 +14,7 @@
 // that things will look really good once we get that lock out of the
 // message path.
 
-use comm::*;
+use oldcomm::*;
 
 extern mod std;
 use std::time;
@@ -22,8 +22,8 @@
 
 fn thread_ring(i: uint,
                count: uint,
-               num_chan: comm::Chan<uint>,
-               num_port: comm::Port<uint>) {
+               num_chan: oldcomm::Chan<uint>,
+               num_port: oldcomm::Port<uint>) {
     // Send/Receive lots of messages.
     for uint::range(0u, count) |j| {
         num_chan.send(i * j);
index d36e8daf376a6534d1ff6ca1933716d43c581a6d..3625dd048b52dd3dd8b3cc2a42a915ba2c059c37 100644 (file)
@@ -95,9 +95,9 @@ fn transform(aa: color, bb: color) -> color {
 fn creature(
     name: uint,
     color: color,
-    from_rendezvous: comm::Port<Option<creature_info>>,
-    to_rendezvous: comm::Chan<creature_info>,
-    to_rendezvous_log: comm::Chan<~str>
+    from_rendezvous: oldcomm::Port<Option<creature_info>>,
+    to_rendezvous: oldcomm::Chan<creature_info>,
+    to_rendezvous_log: oldcomm::Chan<~str>
 ) {
     let mut color = color;
     let mut creatures_met = 0;
@@ -105,8 +105,8 @@ fn creature(
 
     loop {
         // ask for a pairing
-        comm::send(to_rendezvous, {name: name, color: color});
-        let resp = comm::recv(from_rendezvous);
+        oldcomm::send(to_rendezvous, {name: name, color: color});
+        let resp = oldcomm::recv(from_rendezvous);
 
         // log and change, or print and quit
         match resp {
@@ -123,7 +123,7 @@ fn creature(
                 // log creatures met and evil clones of self
                 let report = fmt!("%u", creatures_met) + ~" " +
                              show_number(evil_clones_met);
-                comm::send(to_rendezvous_log, report);
+                oldcomm::send(to_rendezvous_log, report);
                 break;
             }
         }
@@ -132,28 +132,28 @@ fn creature(
 
 fn rendezvous(nn: uint, set: ~[color]) {
 
-    pub fn spawn_listener<A: Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> {
-        let setup_po = comm::Port();
-        let setup_ch = comm::Chan(&setup_po);
+    pub fn spawn_listener<A: Send>(+f: fn~(oldcomm::Port<A>)) -> oldcomm::Chan<A> {
+        let setup_po = oldcomm::Port();
+        let setup_ch = oldcomm::Chan(&setup_po);
         do task::spawn |move f| {
-            let po = comm::Port();
-            let ch = comm::Chan(&po);
-            comm::send(setup_ch, ch);
+            let po = oldcomm::Port();
+            let ch = oldcomm::Chan(&po);
+            oldcomm::send(setup_ch, ch);
             f(move po);
         }
-        comm::recv(setup_po)
+        oldcomm::recv(setup_po)
     }
 
     // these ports will allow us to hear from the creatures
-    let from_creatures:     comm::Port<creature_info> = comm::Port();
-    let from_creatures_log: comm::Port<~str> = comm::Port();
+    let from_creatures:     oldcomm::Port<creature_info> = oldcomm::Port();
+    let from_creatures_log: oldcomm::Port<~str> = oldcomm::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     = oldcomm::Chan(&from_creatures);
+    let to_rendezvous_log = oldcomm::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>>] =
+    let to_creature: ~[oldcomm::Chan<Option<creature_info>>] =
         vec::mapi(set, |ii, col| {
             // create each creature as a listener with a port, and
             // give us a channel to talk to each
@@ -169,24 +169,24 @@ pub fn spawn_listener<A: Send>(+f: fn~(comm::Port<A>)) -> comm::Chan<A> {
 
     // set up meetings...
     for nn.times {
-        let fst_creature: creature_info = comm::recv(from_creatures);
-        let snd_creature: creature_info = comm::recv(from_creatures);
+        let fst_creature: creature_info = oldcomm::recv(from_creatures);
+        let snd_creature: creature_info = oldcomm::recv(from_creatures);
 
         creatures_met += 2;
 
-        comm::send(to_creature[fst_creature.name], Some(snd_creature));
-        comm::send(to_creature[snd_creature.name], Some(fst_creature));
+        oldcomm::send(to_creature[fst_creature.name], Some(snd_creature));
+        oldcomm::send(to_creature[snd_creature.name], Some(fst_creature));
     }
 
     // tell each creature to stop
     for vec::eachi(to_creature) |_ii, to_one| {
-        comm::send(*to_one, None);
+        oldcomm::send(*to_one, None);
     }
 
     // save each creature's meeting stats
     let mut report = ~[];
     for vec::each(to_creature) |_to_one| {
-        report.push(comm::recv(from_creatures_log));
+        report.push(oldcomm::recv(from_creatures_log));
     }
 
     // print each color in the set
index 83f9e77edc570841fa4b072e35949b0fbda52774..2420a02aa237ea6ce77d7579f7bc3218c5b19ceb 100644 (file)
@@ -129,7 +129,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
         _ => { ~"" }
    };
 
-   //comm::send(to_parent, fmt!("yay{%u}", sz));
+   //oldcomm::send(to_parent, fmt!("yay{%u}", sz));
     to_parent.send(move buffer);
 }
 
index 8c234f9e11d0942d8605e6a8cf651ebacf65f43f..a45138d72d9549b461dda8379d81e2ac4547bfc6 100644 (file)
@@ -87,7 +87,7 @@ fn fillbyte(x: cmplx, incr: f64) -> u8 {
     rv
 }
 
-fn chanmb(i: uint, size: uint, ch: comm::Chan<line>) -> ()
+fn chanmb(i: uint, size: uint, ch: oldcomm::Chan<line>) -> ()
 {
     let mut crv = ~[];
     let incr = 2f64/(size as f64);
@@ -97,7 +97,7 @@ fn chanmb(i: uint, size: uint, ch: comm::Chan<line>) -> ()
         let x = cmplx {re: xincr*(j as f64) - 1.5f64, im: y};
         crv.push(fillbyte(x, incr));
     };
-    comm::send(ch, {i:i, b:crv});
+    oldcomm::send(ch, {i:i, b:crv});
 }
 
 type devnull = {dn: int};
@@ -110,11 +110,11 @@ fn flush() -> int {0}
     fn get_type() -> io::WriterType { io::File }
 }
 
-fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
+fn writer(path: ~str, writech: oldcomm::Chan<oldcomm::Chan<line>>, size: uint)
 {
-    let p: comm::Port<line> = comm::Port();
-    let ch = comm::Chan(&p);
-    comm::send(writech, ch);
+    let p: oldcomm::Port<line> = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
+    oldcomm::send(writech, ch);
     let cout: io::Writer = match path {
         ~"" => {
             {dn: 0} as io::Writer
@@ -134,7 +134,7 @@ fn writer(path: ~str, writech: comm::Chan<comm::Chan<line>>, size: uint)
     let mut done = 0_u;
     let mut i = 0_u;
     while i < size {
-        let aline = comm::recv(p);
+        let aline = oldcomm::recv(p);
         if aline.i == done {
             debug!("W %u", aline.i);
             cout.write(aline.b);
@@ -178,12 +178,12 @@ fn main() {
     let size = if vec::len(args) < 2_u { 80_u }
     else { uint::from_str(args[1]).get() };
 
-    let writep = comm::Port();
-    let writech = comm::Chan(&writep);
+    let writep = oldcomm::Port();
+    let writech = oldcomm::Chan(&writep);
     do task::spawn |move path| {
         writer(copy path, writech, size);
     };
-    let ch = comm::recv(writep);
+    let ch = oldcomm::recv(writep);
     for uint::range(0_u, size) |j| {
         task::spawn(|| chanmb(j, size, ch) );
         if j % yieldevery == 0_u {
index c5429086c431426261ac68ba5e6836ef39e3cfb0..80bcb8340542dda03cd84d5be2797415b9530938 100644 (file)
@@ -14,7 +14,7 @@
   A parallel version of fibonacci numbers.
 
   This version is meant mostly as a way of stressing and benchmarking
-  the task system. It supports a lot of command-line arguments to
+  the task system. It supports a lot of oldcommand-line arguments to
   control how it runs.
 
 */
index 1b60cfcd38b5d1f63fa3fa311ab71be59f3a852d..c58f07dad2e482865151b44665fc0417a29a9801 100644 (file)
 // Creates in the background 'num_tasks' tasks, all blocked forever.
 // 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 po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
 
     for num_tasks.times {
         do task::spawn { // linked
-            comm::send(ch, ());
-            comm::recv(comm::Port::<()>()); // block forever
+            oldcomm::send(ch, ());
+            oldcomm::recv(oldcomm::Port::<()>()); // block forever
         }
     }
     error!("Grandchild group getting started");
     for num_tasks.times {
         // Make sure all above children are fully spawned; i.e., enlisted in
         // their ancestor groups.
-        comm::recv(po);
+        oldcomm::recv(po);
     }
     error!("Grandchild group ready to go.");
     // Master grandchild task exits early.
index d6ae6979510bba261854ee4dcda7988800b1bdcf..e4c7718325ff696fae9ce570d2b29664d3d48428 100644 (file)
 // Test for concurrent tasks
 
 enum msg {
-    ready(comm::Chan<msg>),
+    ready(oldcomm::Chan<msg>),
     start,
     done(int),
 }
 
-fn calc(children: uint, parent_ch: comm::Chan<msg>) {
-    let port = comm::Port();
-    let chan = comm::Chan(&port);
+fn calc(children: uint, parent_ch: oldcomm::Chan<msg>) {
+    let port = oldcomm::Port();
+    let chan = oldcomm::Chan(&port);
     let mut child_chs = ~[];
     let mut sum = 0;
 
@@ -29,7 +29,7 @@ fn calc(children: uint, parent_ch: comm::Chan<msg>) {
     }
 
     for iter::repeat (children) {
-        match comm::recv(port) {
+        match oldcomm::recv(port) {
           ready(child_ch) => {
             child_chs.push(child_ch);
           }
@@ -37,25 +37,25 @@ fn calc(children: uint, parent_ch: comm::Chan<msg>) {
         }
     }
 
-    comm::send(parent_ch, ready(chan));
+    oldcomm::send(parent_ch, ready(chan));
 
-    match comm::recv(port) {
+    match oldcomm::recv(port) {
         start => {
             for vec::each(child_chs) |child_ch| {
-                comm::send(*child_ch, start);
+                oldcomm::send(*child_ch, start);
             }
         }
         _ => fail ~"task-perf-one-million failed (port not in start state)"
     }
 
     for iter::repeat (children) {
-        match comm::recv(port) {
+        match oldcomm::recv(port) {
           done(child_sum) => { sum += child_sum; }
           _ => fail ~"task-perf-one-million failed (port not done)"
         }
     }
 
-    comm::send(parent_ch, done(sum + 1));
+    oldcomm::send(parent_ch, done(sum + 1));
 }
 
 fn main() {
@@ -69,18 +69,18 @@ fn main() {
     };
 
     let children = uint::from_str(args[1]).get();
-    let port = comm::Port();
-    let chan = comm::Chan(&port);
+    let port = oldcomm::Port();
+    let chan = oldcomm::Chan(&port);
     do task::spawn {
         calc(children, chan);
     };
-    match comm::recv(port) {
+    match oldcomm::recv(port) {
       ready(chan) => {
-        comm::send(chan, start);
+        oldcomm::send(chan, start);
       }
       _ => fail ~"task-perf-one-million failed (port not ready)"
     }
-    let sum = match comm::recv(port) {
+    let sum = match oldcomm::recv(port) {
       done(sum) => { sum }
       _ => fail ~"task-perf-one-million failed (port not done)"
     };
index 8cee0b5f7f35956676bb7c3357c0bcd853f9344e..5c09248b59c1ba910efd5c3f81a93beb57ac3f1c 100644 (file)
@@ -13,7 +13,7 @@
 
    This is meant primarily to demonstrate Rust's MapReduce framework.
 
-   It takes a list of files on the command line and outputs a list of
+   It takes a list of files on the oldcommand line and outputs a list of
    words along with how many times each word is used.
 
 */
 
 use std::time;
 
-use comm::Chan;
-use comm::Port;
-use comm::recv;
-use comm::send;
+use oldcomm::Chan;
+use oldcomm::Port;
+use oldcomm::recv;
+use oldcomm::send;
 use cmp::Eq;
 use to_bytes::IterBytes;
 
index 6143e869988710c974512d8f1255a70279dfdf64..98220195e613d90f784fed3cece9ca70e90e79e9 100644 (file)
@@ -12,7 +12,7 @@
 
 extern mod std;
 use std::arc;
-use comm::*;
+use oldcomm::*;
 
 fn main() {
     let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
index cd059e3255072787d3f200d2aebb9427c06aa8da..8cb8f31c4897682fd5e9de0b3758c9806441b30d 100644 (file)
@@ -10,7 +10,7 @@
 
 extern mod std;
 use std::arc;
-use comm::*;
+use oldcomm::*;
 
 fn main() {
     let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
index fee93e9b8388700ce845f09e1db4bb44d97b05b2..4dd0df31aab8dad62d560a825d18f40fbb84c7ec 100644 (file)
 
 fn main() {
     struct foo {
-      _x: comm::Port<()>,
+      _x: oldcomm::Port<()>,
     }
 
     impl foo : Drop {
         fn finalize(&self) {}
     }
 
-    fn foo(x: comm::Port<()>) -> foo {
+    fn foo(x: oldcomm::Port<()>) -> foo {
         foo {
             _x: x
         }
     }
    
-    let x = ~mut Some(foo(comm::Port()));
+    let x = ~mut Some(foo(oldcomm::Port()));
 
     do task::spawn |move x| { //~ ERROR not a sendable value
         let mut y = None;
index ef9e0aae95e6be5470561f82238e34190b4d6db6..7f60e3ec87a0320cf2af6b1de66c04d0fa51e378 100644 (file)
@@ -25,7 +25,7 @@ fn foo(i:int, j: @~str) -> foo {
 
 fn main() {
   let cat = ~"kitty";
-  let po = comm::Port();         //~ ERROR missing `owned`
-  let ch = comm::Chan(&po);       //~ ERROR missing `owned`
-  comm::send(ch, foo(42, @(move cat))); //~ ERROR missing `owned`
+  let po = oldcomm::Port();         //~ ERROR missing `owned`
+  let ch = oldcomm::Chan(&po);       //~ ERROR missing `owned`
+  oldcomm::send(ch, foo(42, @(move cat))); //~ ERROR missing `owned`
 }
index c1c9142fdd90af43b4815ef8d36b607d979042f3..8154329f7ae37fb78fd802e38663aa689c274e35 100644 (file)
@@ -12,8 +12,8 @@
 
 // error-pattern:1 == 2
 extern mod std;
-use comm::Port;
-use comm::recv;
+use oldcomm::Port;
+use oldcomm::recv;
 
 fn child() { assert (1 == 2); }
 
index 6a53980ad920be8ddaf53417ac8e25a34cde9d34..1a95118d0a61f569d18386ca3931e668b38bb3d2 100644 (file)
@@ -12,9 +12,9 @@
 
 // error-pattern:fail
 extern mod std;
-use comm::Chan;
-use comm::Port;
-use comm::recv;
+use oldcomm::Chan;
+use oldcomm::Port;
+use oldcomm::recv;
 
 fn child() { fail; }
 
index 589cc88903540780ae28a9dda76a05a1ad98ad31..5df06ff6f81f81e6668c7776229719163acd221e 100644 (file)
@@ -12,8 +12,8 @@
 
 // error-pattern:fail
 extern mod std;
-use comm::Port;
-use comm::recv;
+use oldcomm::Port;
+use oldcomm::recv;
 
 fn grandchild() { fail ~"grandchild dies"; }
 
index cdea1f14a95b13e73271fdc736e47097370d2ef9..ea9c9f22e220bb20ec07e88bff70b18e158094a4 100644 (file)
@@ -11,9 +11,9 @@
 
 // error-pattern:1 == 2
 extern mod std;
-use comm::Chan;
-use comm::Port;
-use comm::recv;
+use oldcomm::Chan;
+use oldcomm::Port;
+use oldcomm::recv;
 
 fn child() { assert (1 == 2); }
 
index 8b4c1e3ea30a5a3e27c9a18cd49296ea0cf0a0f6..bd1541302a40f5369cd262b996e05215fdb531ea 100644 (file)
 
 // error-pattern:meep
 extern mod std;
-use comm::Chan;
-use comm::Port;
-use comm::send;
-use comm::recv;
+use oldcomm::Chan;
+use oldcomm::Port;
+use oldcomm::send;
+use oldcomm::recv;
 
 fn echo<T: Owned>(c: Chan<T>, oc: Chan<Chan<T>>) {
     // Tests that the type argument in port gets
index 9f23fa0044bbd1ebd8cbe3137b96fb9bba525e3f..6c70dd09d57fcf615dd3f5b2b6a4afe01f235273 100644 (file)
@@ -19,9 +19,9 @@ fn goodfail() {
 
 fn main() {
     task::spawn(|| goodfail() );
-    let po = comm::Port();
+    let po = oldcomm::Port();
     // We shouldn't be able to get past this recv since there's no
     // message available
-    let i: int = comm::recv(po);
+    let i: int = oldcomm::recv(po);
     fail ~"badfail";
 }
index ede596c32e15a9f1a1f883d27cc4cb1845d88b75..8f31520557379d682f5b598e6ccf494cd9bcbb6a 100644 (file)
 
 extern mod std;
 
-fn f(c: comm::_chan<int>) {
+fn f(c: oldcomm::_chan<int>) {
     type t = {_0: int, _1: int, _2: int};
 
     // Allocate a box.
     let x: @t = @{_0: 1, _1: 2, _2: 3};
 
     // Signal parent that we've allocated a box.
-    comm::send(c, 1);
+    oldcomm::send(c, 1);
 
 
     loop {
@@ -31,12 +31,12 @@ fn f(c: comm::_chan<int>) {
         // sending to the channel are never received
         // by the parent, therefore this test cases drops
         // messages on the floor
-        comm::send(c, 1);
+        oldcomm::send(c, 1);
     }
 }
 
 fn main() {
-    let p = comm::mk_port();
+    let p = oldcomm::mk_port();
     task::_spawn(bind f(p.mk_chan()));
     let i: int;
 
index 5472903f32b300d9d4998bdeb8fbad8be825fbe5..1a0ba61eb19851387b08ae5ed98e8f94b92359a2 100644 (file)
@@ -15,7 +15,7 @@
 extern mod std;
 
 // These tests used to be separate files, but I wanted to refactor all
-// the common code.
+// the oldcommon code.
 
 use cmp::Eq;
 use std::ebml;
index 834040e0e57f9fc6a34ba4e7f40a69b2d179977e..7f7da086df30ce042e169db9bd9131c142f21daa 100644 (file)
 // except according to those terms.
 
 
-fn a(c: core::comm::Chan<int>) { core::comm::send(c, 10); }
+fn a(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 10); }
 
 fn main() {
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     task::spawn(|| a(ch) );
     task::spawn(|| a(ch) );
     let mut n: int = 0;
-    n = core::comm::recv(p);
-    n = core::comm::recv(p);
+    n = core::oldcomm::recv(p);
+    n = core::oldcomm::recv(p);
     //    debug!("Finished.");
 }
 
-fn b(c: core::comm::Chan<int>) {
+fn b(c: core::oldcomm::Chan<int>) {
     //    debug!("task b0");
     //    debug!("task b1");
     //    debug!("task b2");
     //    debug!("task b3");
     //    debug!("task b4");
     //    debug!("task b5");
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
 }
index df8eb39da30433d34d15ca2f3cb895a7aefe3c7b..36ed4c5162b67f611313333a8ceb83420c863cc1 100644 (file)
 // except according to those terms.
 
 
-fn a(c: core::comm::Chan<int>) {
+fn a(c: core::oldcomm::Chan<int>) {
     debug!("task a0");
     debug!("task a1");
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
 }
 
 fn main() {
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     task::spawn(|| a(ch) );
     task::spawn(|| b(ch) );
     let mut n: int = 0;
-    n = core::comm::recv(p);
-    n = core::comm::recv(p);
+    n = core::oldcomm::recv(p);
+    n = core::oldcomm::recv(p);
     debug!("Finished.");
 }
 
-fn b(c: core::comm::Chan<int>) {
+fn b(c: core::oldcomm::Chan<int>) {
     debug!("task b0");
     debug!("task b1");
     debug!("task b2");
     debug!("task b2");
     debug!("task b3");
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
 }
index bc7b194d7b4e30d0d3975ec30d2ef639ade04e2a..a84bfdcdbb7ee4c8acd585357f6753534ccc9fec 100644 (file)
@@ -10,7 +10,7 @@
 // except according to those terms.
 
 
-fn a(c: core::comm::Chan<int>) {
+fn a(c: core::oldcomm::Chan<int>) {
     if true {
         debug!("task a");
         debug!("task a");
@@ -18,7 +18,7 @@ fn a(c: core::comm::Chan<int>) {
         debug!("task a");
         debug!("task a");
     }
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
 }
 
 fn k(x: int) -> int { return 15; }
@@ -33,19 +33,19 @@ fn g(x: int, y: ~str) -> int {
 fn main() {
     let mut n: int = 2 + 3 * 7;
     let s: ~str = ~"hello there";
-    let p = comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     task::spawn(|| a(ch) );
     task::spawn(|| b(ch) );
     let mut x: int = 10;
     x = g(n, s);
     log(debug, x);
-    n = core::comm::recv(p);
-    n = core::comm::recv(p);
+    n = core::oldcomm::recv(p);
+    n = core::oldcomm::recv(p);
     debug!("children finished, root finishing");
 }
 
-fn b(c: core::comm::Chan<int>) {
+fn b(c: core::oldcomm::Chan<int>) {
     if true {
         debug!("task b");
         debug!("task b");
@@ -54,5 +54,5 @@ fn b(c: core::comm::Chan<int>) {
         debug!("task b");
         debug!("task b");
     }
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
 }
index c82fc0bcd6860a0238204c64571bc03f3b44bdc6..8f9049ac27b2baa7c8f6186ab83c891b75d68d3a 100644 (file)
@@ -24,9 +24,9 @@
 // course preferable, as the value itself is
 // irrelevant).
 
-fn foo(&&x: ()) -> core::comm::Port<()> {
-    let p = core::comm::Port();
-    let c = core::comm::Chan(&p);
+fn foo(&&x: ()) -> core::oldcomm::Port<()> {
+    let p = core::oldcomm::Port();
+    let c = core::oldcomm::Chan(&p);
     do task::spawn() |copy c, copy x| {
         c.send(x);
     }
index 447363117bc814c9e783c24d1c1608ca0cd1e61f..be64fcd8992fade591095fa24403042d740af9ca 100644 (file)
@@ -18,7 +18,7 @@
 
 extern mod cci_capture_clause;
 
-use comm::recv;
+use oldcomm::recv;
 
 fn main() {
     cci_capture_clause::foo(()).recv()
index b88799c4475d37ac05cdc6d76e5f1cd0f61dd5e8..bb429a07f39dbc5ea0b9bdf777b8402cf735aac7 100644 (file)
 
 // Issue #763
 
-enum request { quit, close(core::comm::Chan<bool>), }
+enum request { quit, close(core::oldcomm::Chan<bool>), }
 
-type ctx = core::comm::Chan<request>;
+type ctx = core::oldcomm::Chan<request>;
 
-fn request_task(c: core::comm::Chan<ctx>) {
-    let p = core::comm::Port();
-    core::comm::send(c, core::comm::Chan(&p));
+fn request_task(c: core::oldcomm::Chan<ctx>) {
+    let p = core::oldcomm::Port();
+    core::oldcomm::send(c, core::oldcomm::Chan(&p));
     let mut req: request;
-    req = core::comm::recv(p);
+    req = core::oldcomm::recv(p);
     // Need to drop req before receiving it again
-    req = core::comm::recv(p);
+    req = core::oldcomm::recv(p);
 }
 
 fn new_cx() -> ctx {
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     let t = task::spawn(|| request_task(ch) );
     let mut cx: ctx;
-    cx = core::comm::recv(p);
+    cx = core::oldcomm::recv(p);
     return cx;
 }
 
 fn main() {
     let cx = new_cx();
 
-    let p = core::comm::Port::<bool>();
-    core::comm::send(cx, close(core::comm::Chan(&p)));
-    core::comm::send(cx, quit);
+    let p = core::oldcomm::Port::<bool>();
+    core::oldcomm::send(cx, close(core::oldcomm::Chan(&p)));
+    core::oldcomm::send(cx, quit);
 }
index cae462c4d5d930f3467adf00409b05376a12612c..453ae679523191f378ef8d9e296179bd65f786d7 100644 (file)
 
 
 fn main() {
-    let p = comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     let t = task::spawn(|| child(ch) );
-    let y = core::comm::recv(p);
+    let y = core::oldcomm::recv(p);
     error!("received");
     log(error, y);
     assert (y == 10);
 }
 
-fn child(c: core::comm::Chan<int>) {
+fn child(c: core::oldcomm::Chan<int>) {
     error!("sending");
-    core::comm::send(c, 10);
+    core::oldcomm::send(c, 10);
     error!("value sent");
 }
index 4d1ad84225d4e4bb0a14e96b2b7c75015388ac37..4b4d6a86806d1bc7e812efa75bce5a0f4dda175c 100644 (file)
 
 
 fn main() {
-    let po = core::comm::Port();
-    let ch = core::comm::Chan(&po);
-    core::comm::send(ch, 10);
-    let i = core::comm::recv(po);
+    let po = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&po);
+    core::oldcomm::send(ch, 10);
+    let i = core::oldcomm::recv(po);
     assert (i == 10);
-    core::comm::send(ch, 11);
-    let j = core::comm::recv(po);
+    core::oldcomm::send(ch, 11);
+    let j = core::oldcomm::recv(po);
     assert (j == 11);
 }
index e8204d48f33ee875af755d95cde3913f9a6f799e..c8fbb0dd7418ba0a36ef61c4bc814ce7bd392c53 100644 (file)
 
 use std::map;
 use std::map::HashMap;
-use comm::Chan;
-use comm::Port;
-use comm::send;
-use comm::recv;
+use oldcomm::Chan;
+use oldcomm::Port;
+use oldcomm::send;
+use oldcomm::recv;
 
 fn map(filename: ~str, emit: map_reduce::putter) { emit(filename, ~"1"); }
 
index 5d267f9d91447bba2960c9be02a7a2177e0d3809..556e597a86da7c6637433e9c1affc9a306aa0c85 100644 (file)
    https://github.com/graydon/rust/issues/507
 */
 
-fn grandchild(c: core::comm::Chan<int>) { core::comm::send(c, 42); }
+fn grandchild(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 42); }
 
-fn child(c: core::comm::Chan<int>) {
+fn child(c: core::oldcomm::Chan<int>) {
     task::spawn(|| grandchild(c) )
 }
 
 fn main() {
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
 
     task::spawn(|| child(ch) );
 
-    let x: int = core::comm::recv(p);
+    let x: int = core::oldcomm::recv(p);
 
     log(debug, x);
 
index bac6dc67ac2bf84b4af6dda6d653c091a8d9abca..9cfec06007c95fd9715109d054bdab9ff2136b6e 100644 (file)
 
 enum msg { closed, received(~[u8]), }
 
-fn producer(c: core::comm::Chan<~[u8]>) {
-    core::comm::send(c, ~[1u8, 2u8, 3u8, 4u8]);
+fn producer(c: core::oldcomm::Chan<~[u8]>) {
+    core::oldcomm::send(c, ~[1u8, 2u8, 3u8, 4u8]);
     let empty: ~[u8] = ~[];
-    core::comm::send(c, empty);
+    core::oldcomm::send(c, empty);
 }
 
-fn packager(cb: core::comm::Chan<core::comm::Chan<~[u8]>>, msg: core::comm::Chan<msg>) {
-    let p: core::comm::Port<~[u8]> = core::comm::Port();
-    core::comm::send(cb, core::comm::Chan(&p));
+fn packager(cb: core::oldcomm::Chan<core::oldcomm::Chan<~[u8]>>, msg: core::oldcomm::Chan<msg>) {
+    let p: core::oldcomm::Port<~[u8]> = core::oldcomm::Port();
+    core::oldcomm::send(cb, core::oldcomm::Chan(&p));
     loop {
         debug!("waiting for bytes");
-        let data = core::comm::recv(p);
+        let data = core::oldcomm::recv(p);
         debug!("got bytes");
         if vec::len(data) == 0u {
             debug!("got empty bytes, quitting");
@@ -29,26 +29,26 @@ fn packager(cb: core::comm::Chan<core::comm::Chan<~[u8]>>, msg: core::comm::Chan
         }
         debug!("sending non-empty buffer of length");
         log(debug, vec::len(data));
-        core::comm::send(msg, received(data));
+        core::oldcomm::send(msg, received(data));
         debug!("sent non-empty buffer");
     }
     debug!("sending closed message");
-    core::comm::send(msg, closed);
+    core::oldcomm::send(msg, closed);
     debug!("sent closed message");
 }
 
 fn main() {
-    let p: core::comm::Port<msg> = core::comm::Port();
-    let ch = core::comm::Chan(&p);
-    let recv_reader: core::comm::Port<core::comm::Chan<~[u8]>> = core::comm::Port();
-    let recv_reader_chan = core::comm::Chan(&recv_reader);
+    let p: core::oldcomm::Port<msg> = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
+    let recv_reader: core::oldcomm::Port<core::oldcomm::Chan<~[u8]>> = core::oldcomm::Port();
+    let recv_reader_chan = core::oldcomm::Chan(&recv_reader);
     let pack = task::spawn(|| packager(recv_reader_chan, ch) );
 
-    let source_chan: core::comm::Chan<~[u8]> = core::comm::recv(recv_reader);
+    let source_chan: core::oldcomm::Chan<~[u8]> = core::oldcomm::recv(recv_reader);
     let prod = task::spawn(|| producer(source_chan) );
 
     loop {
-        let msg = core::comm::recv(p);
+        let msg = core::oldcomm::recv(p);
         match msg {
           closed => { debug!("Got close message"); break; }
           received(data) => {
index 2654a7385993f09637f3a1e37d943a772956e657..3820ff770227cedbab120a3cc1e9aadee95c48b9 100644 (file)
 
 fn a() {
     fn doit() {
-        fn b(c: core::comm::Chan<core::comm::Chan<int>>) {
-            let p = core::comm::Port();
-            core::comm::send(c, core::comm::Chan(&p));
+        fn b(c: core::oldcomm::Chan<core::oldcomm::Chan<int>>) {
+            let p = core::oldcomm::Port();
+            core::oldcomm::send(c, core::oldcomm::Chan(&p));
         }
-        let p = core::comm::Port();
-        let ch = core::comm::Chan(&p);
+        let p = core::oldcomm::Port();
+        let ch = core::oldcomm::Chan(&p);
         task::spawn(|| b(ch) );
-        core::comm::recv(p);
+        core::oldcomm::recv(p);
     }
     let mut i = 0;
     while i < 100 {
index 4a33d770872b03718263aa142e6f7baf2edc71b5..7066b5f63cd60d774fb5caf627b4062ec99e8736 100644 (file)
@@ -1,13 +1,13 @@
-fn producer(c: core::comm::Chan<~[u8]>) {
-    core::comm::send(c,
+fn producer(c: core::oldcomm::Chan<~[u8]>) {
+    core::oldcomm::send(c,
          ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8,
           13u8]);
 }
 
 fn main() {
-    let p: core::comm::Port<~[u8]> = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p: core::oldcomm::Port<~[u8]> = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     let prod = task::spawn(|| producer(ch) );
 
-    let data: ~[u8] = core::comm::recv(p);
+    let data: ~[u8] = core::oldcomm::recv(p);
 }
index a093b89b70f4b99d24a2302ee2c7a37028da0e3e..34244c2ef01cbb7501887764346f6acb91f59dba 100644 (file)
 // except according to those terms.
 
 fn main() {
-    let p = core::comm::Port();
-    let ch = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&p);
     let mut y: int;
 
     task::spawn(|| child(ch) );
-    y = core::comm::recv(p);
+    y = core::oldcomm::recv(p);
     debug!("received 1");
     log(debug, y);
     assert (y == 10);
 
     task::spawn(|| child(ch) );
-    y = core::comm::recv(p);
+    y = core::oldcomm::recv(p);
     debug!("received 2");
     log(debug, y);
     assert (y == 10);
 }
 
-fn child(c: core::comm::Chan<int>) { core::comm::send(c, 10); }
+fn child(c: core::oldcomm::Chan<int>) { core::oldcomm::send(c, 10); }
index dd0ff175260dfada7dfbc5429c03aca533c791c0..23153b79cd94bc35489b32686121211fb577a9db 100644 (file)
 
 extern mod std;
 
-fn sub(parent: comm::Chan<int>, id: int) {
+fn sub(parent: oldcomm::Chan<int>, id: int) {
     if id == 0 {
-        comm::send(parent, 0);
+        oldcomm::send(parent, 0);
     } else {
-        let p = comm::Port();
-        let ch = comm::Chan(&p);
+        let p = oldcomm::Port();
+        let ch = oldcomm::Chan(&p);
         let child = task::spawn(|| sub(ch, id - 1) );
-        let y = comm::recv(p);
-        comm::send(parent, y + 1);
+        let y = oldcomm::recv(p);
+        oldcomm::send(parent, y + 1);
     }
 }
 
 fn main() {
-    let p = comm::Port();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
     let child = task::spawn(|| sub(ch, 200) );
-    let y = comm::recv(p);
+    let y = oldcomm::recv(p);
     debug!("transmission complete");
     log(debug, y);
     assert (y == 200);
index 397415150ca1293135d256e7e5bb37c629d96775..993dea560cf2aaa26845011bad5e6e1c140bc476 100644 (file)
@@ -11,6 +11,6 @@
 
 
 /*
- * This is a multi-line comment.
+ * This is a multi-line oldcomment.
  */
 fn main() { }
index 6fde5bef741360cc57a227d9342c9013e6b8f8d6..dca62e0f9dffa6e6a9c72a15308f2a80a25e4920 100644 (file)
@@ -13,7 +13,7 @@
 // Regression tests for circular_buffer when using a unit
 // that has a size that is not a power of two
 
-// A 12-byte unit to core::comm::send over the channel
+// A 12-byte unit to core::oldcomm::send over the channel
 type record = {val1: u32, val2: u32, val3: u32};
 
 
 // power of two so needs to be rounded up. Don't trigger any
 // assertions.
 fn test_init() {
-    let myport = core::comm::Port();
-    let mychan = core::comm::Chan(&myport);
+    let myport = core::oldcomm::Port();
+    let mychan = core::oldcomm::Chan(&myport);
     let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
-    core::comm::send(mychan, val);
+    core::oldcomm::send(mychan, val);
 }
 
 
 // Dump lots of items into the channel so it has to grow.
 // Don't trigger any assertions.
 fn test_grow() {
-    let myport = core::comm::Port();
-    let mychan = core::comm::Chan(&myport);
+    let myport = core::oldcomm::Port();
+    let mychan = core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |i| {
         let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
-        core::comm::send(mychan, val);
+        core::oldcomm::send(mychan, val);
     }
 }
 
 
 // Don't allow the buffer to shrink below it's original size
 fn test_shrink1() {
-    let myport = core::comm::Port();
-    let mychan = core::comm::Chan(&myport);
-    core::comm::send(mychan, 0i8);
-    let x = core::comm::recv(myport);
+    let myport = core::oldcomm::Port();
+    let mychan = core::oldcomm::Chan(&myport);
+    core::oldcomm::send(mychan, 0i8);
+    let x = core::oldcomm::recv(myport);
 }
 
 fn test_shrink2() {
-    let myport = core::comm::Port();
-    let mychan = core::comm::Chan(&myport);
+    let myport = core::oldcomm::Port();
+    let mychan = core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |_i| {
         let val: record = {val1: 0u32, val2: 0u32, val3: 0u32};
-        core::comm::send(mychan, val);
+        core::oldcomm::send(mychan, val);
     }
-    for uint::range(0u, 100u) |_i| { let x = core::comm::recv(myport); }
+    for uint::range(0u, 100u) |_i| { let x = core::oldcomm::recv(myport); }
 }
 
 
 // Test rotating the buffer when the unit size is not a power of two
 fn test_rotate() {
-    let myport = core::comm::Port();
-    let mychan = core::comm::Chan(&myport);
+    let myport = core::oldcomm::Port();
+    let mychan = core::oldcomm::Chan(&myport);
     for uint::range(0u, 100u) |i| {
         let val = {val1: i as u32, val2: i as u32, val3: i as u32};
-        core::comm::send(mychan, val);
-        let x = core::comm::recv(myport);
+        core::oldcomm::send(mychan, val);
+        let x = core::oldcomm::recv(myport);
         assert (x.val1 == i as u32);
         assert (x.val2 == i as u32);
         assert (x.val3 == i as u32);
@@ -78,16 +78,16 @@ fn test_rotate() {
 // Test rotating and growing the buffer when
 // the unit size is not a power of two
 fn test_rotate_grow() {
-    let myport = core::comm::Port::<record>();
-    let mychan = core::comm::Chan(&myport);
+    let myport = core::oldcomm::Port::<record>();
+    let mychan = core::oldcomm::Chan(&myport);
     for uint::range(0u, 10u) |j| {
         for uint::range(0u, 10u) |i| {
             let val: record =
                 {val1: i as u32, val2: i as u32, val3: i as u32};
-            core::comm::send(mychan, val);
+            core::oldcomm::send(mychan, val);
         }
         for uint::range(0u, 10u) |i| {
-            let x = core::comm::recv(myport);
+            let x = core::oldcomm::recv(myport);
             assert (x.val1 == i as u32);
             assert (x.val2 == i as u32);
             assert (x.val3 == i as u32);
index ed45627a3798547d1adb0e30f9ea04d00cbdb2ba..09f9bee75276acec5f0e0b0dae156cd278fc5add 100644 (file)
@@ -25,8 +25,8 @@
 }
 
 fn main() unsafe {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
     let parent_sched_id = rustrt::rust_get_sched_id();
     error!("parent %?", parent_sched_id);
     let num_threads = 1u;
@@ -39,10 +39,10 @@ fn main() unsafe {
         error!("child_sched_id %?", child_sched_id);
         assert child_sched_id != parent_sched_id;
         assert child_sched_id == new_sched_id;
-        comm::send(ch, ());
+        oldcomm::send(ch, ());
     };
     let fptr = cast::reinterpret_cast(&ptr::addr_of(&f));
     rustrt::start_task(new_task_id, fptr);
     cast::forget(move f);
-    comm::recv(po);
+    oldcomm::recv(po);
 }
index 613c5a86eec251d9bf652ff69e8806b866e6e252..6e6c64f4533cb6d6efb8083de2c3b6af7f578b4d 100644 (file)
@@ -17,13 +17,13 @@ fn die() {
 
 fn iloop() {
     task::spawn(|| die() );
-    let p = comm::Port::<()>();
-    let c = comm::Chan(&p);
+    let p = oldcomm::Port::<()>();
+    let c = oldcomm::Chan(&p);
     loop {
         // Sending and receiving here because these actions yield,
         // at which point our child can kill us
-        comm::send(c, ());
-        comm::recv(p);
+        oldcomm::send(c, ());
+        oldcomm::recv(p);
     }
 }
 
index 75d526aa2c787adb96f5028ae93cc5f1202b79d9..a85b01acc8eddb6016893f7b242b19d1428bbc7e 100644 (file)
@@ -23,12 +23,12 @@ fn test(f: int) -> test {
 }
 
 fn main() {
-    let p = core::comm::Port();
-    let c = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let c = core::oldcomm::Chan(&p);
 
     do task::spawn() {
-        let p = core::comm::Port();
-        c.send(core::comm::Chan(&p));
+        let p = core::oldcomm::Port();
+        c.send(core::oldcomm::Chan(&p));
 
         let _r = p.recv();
     }
index a8878075b269cc487104779a6b7d9ef988d80222..8476e256cd24cf2e505051a19a3c8787ad738ec5 100644 (file)
@@ -11,8 +11,8 @@
 // tests that ctrl's type gets inferred properly
 type command<K: Owned, V: Owned> = {key: K, val: V};
 
-fn cache_server<K: Owned, V: Owned>(c: core::comm::Chan<core::comm::Chan<command<K, V>>>) {
-    let ctrl = core::comm::Port();
-    core::comm::send(c, core::comm::Chan(&ctrl));
+fn cache_server<K: Owned, V: Owned>(c: oldcomm::Chan<oldcomm::Chan<command<K, V>>>) {
+    let ctrl = oldcomm::Port();
+    oldcomm::send(c, oldcomm::Chan(&ctrl));
 }
 fn main() { }
index 53298cee2c85fafc6d7cb90f27899cbfe84b4526..e027bddb8f189b13e7d58b22d10aaa6da0d54c7c 100644 (file)
@@ -23,7 +23,7 @@ fn foo(i:int, j: char) -> foo {
 }
 
 fn main() {
-  let po = comm::Port::<foo>();
-  let ch = comm::Chan(&po);
-  comm::send(ch, foo(42, 'c'));
+  let po = oldcomm::Port::<foo>();
+  let ch = oldcomm::Chan(&po);
+  oldcomm::send(ch, foo(42, 'c'));
 }
\ No newline at end of file
index 64359bfae43295560a79d43803226d28977db191..1a6cf7e04cccad98759802ab8c8e356863956d4a 100644 (file)
@@ -13,8 +13,8 @@
 
 extern mod std;
 
-use comm::Chan;
-use comm::send;
+use oldcomm::Chan;
+use oldcomm::send;
 
 fn main() { test05(); }
 
index 96e02dfb73ba609ea2287e37ef9361ace801aeb7..78914f0531f8a5d745929961d7506f5871161199 100644 (file)
 extern mod std;
 
 
-type ctx = comm::Chan<int>;
+type ctx = oldcomm::Chan<int>;
 
 fn iotask(cx: ctx, ip: ~str) {
     assert (ip == ~"localhost");
 }
 
 fn main() {
-    let p = comm::Port::<int>();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port::<int>();
+    let ch = oldcomm::Chan(&p);
     task::spawn(|| iotask(ch, ~"localhost") );
 }
index 4379c89ba2efdb7c1930543286d40ee9b2dfd0bc..f2c0c807e82ff2a4d62ef2f129e969639f33f343 100644 (file)
@@ -11,7 +11,7 @@
 extern mod std;
 
 fn main() {
-    let p = comm::Port();
-    let c = comm::Chan(&p);
-    comm::send(c, ~"coffee");
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
+    oldcomm::send(c, ~"coffee");
 }
\ No newline at end of file
index 4379c89ba2efdb7c1930543286d40ee9b2dfd0bc..f2c0c807e82ff2a4d62ef2f129e969639f33f343 100644 (file)
@@ -11,7 +11,7 @@
 extern mod std;
 
 fn main() {
-    let p = comm::Port();
-    let c = comm::Chan(&p);
-    comm::send(c, ~"coffee");
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
+    oldcomm::send(c, ~"coffee");
 }
\ No newline at end of file
index f1062680982331a86e2a4599c3ad4bb0ec4c62cc..23b87fb7352026296aa8fedd77566c403f7cbf72 100644 (file)
@@ -12,8 +12,8 @@
 
 fn main() {
     let c = {
-        let p = comm::Port();
-        comm::Chan(&p)
+        let p = oldcomm::Port();
+        oldcomm::Chan(&p)
     };
-    comm::send(c, ~"coffee");
+    oldcomm::send(c, ~"coffee");
 }
\ No newline at end of file
index 7c23609db7a0a548cb25fbddb973da0afe26c0d3..2afdcc6326807bade7a71b71a03e3c80ce9f37bd 100644 (file)
 // We're trying to trigger a race between send and port destruction that
 // results in the string not being freed
 
-fn starship(&&ch: comm::Chan<~str>) {
+fn starship(&&ch: oldcomm::Chan<~str>) {
     for int::range(0, 10) |_i| {
-        comm::send(ch, ~"pew pew");
+        oldcomm::send(ch, ~"pew pew");
     }
 }
 
 fn starbase() {
     for int::range(0, 10) |_i| {
-        let p = comm::Port();
-        let c = comm::Chan(&p);
+        let p = oldcomm::Port();
+        let c = oldcomm::Chan(&p);
         task::spawn(|| starship(c) );
         task::yield();
     }
index 646d88124b913e6c7a7b521f8f70ad5de89a24ae..620262065a5c980cad9d035466605e2373e16f35 100644 (file)
@@ -16,9 +16,9 @@
 // any size, but rustc currently can because they do have size. Whether
 // or not this is desirable I don't know, but here's a regression test.
 fn main() {
-    let po = comm::Port();
-    let ch = comm::Chan(&po);
-    comm::send(ch, ());
-    let n: () = comm::recv(po);
+    let po = oldcomm::Port();
+    let ch = oldcomm::Chan(&po);
+    oldcomm::send(ch, ());
+    let n: () = oldcomm::recv(po);
     assert (n == ());
 }
index 5147c2ba6e49179785a8f08ce4a32ac19e764b5b..d95f4af791c654d8fda8f67936b573330cdc6f76 100644 (file)
@@ -17,12 +17,12 @@ fn main() {
     test06();
 }
 
-fn test00_start(ch: core::comm::Chan<int>, message: int, count: int) {
+fn test00_start(ch: core::oldcomm::Chan<int>, message: int, count: int) {
     debug!("Starting test00_start");
     let mut i: int = 0;
     while i < count {
         debug!("Sending Message");
-        core::comm::send(ch, message + 0);
+        core::oldcomm::send(ch, message + 0);
         i = i + 1;
     }
     debug!("Ending test00_start");
@@ -33,8 +33,8 @@ fn test00() {
     let number_of_messages: int = 4;
     debug!("Creating tasks");
 
-    let po = core::comm::Port();
-    let ch = core::comm::Chan(&po);
+    let po = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&po);
 
     let mut i: int = 0;
 
@@ -50,7 +50,7 @@ fn test00() {
     let mut sum: int = 0;
     for results.each |r| {
         i = 0;
-        while i < number_of_messages { sum += core::comm::recv(po); i = i + 1; }
+        while i < number_of_messages { sum += core::oldcomm::recv(po); i = i + 1; }
     }
 
     for results.each |r| { r.recv(); }
@@ -63,19 +63,19 @@ fn test00() {
 }
 
 fn test01() {
-    let p = core::comm::Port();
+    let p = core::oldcomm::Port();
     debug!("Reading from a port that is never written to.");
-    let value: int = core::comm::recv(p);
+    let value: int = core::oldcomm::recv(p);
     log(debug, value);
 }
 
 fn test02() {
-    let p = core::comm::Port();
-    let c = core::comm::Chan(&p);
+    let p = core::oldcomm::Port();
+    let c = core::oldcomm::Chan(&p);
     debug!("Writing to a local task channel.");
-    core::comm::send(c, 42);
+    core::oldcomm::send(c, 42);
     debug!("Reading from a local task port.");
-    let value: int = core::comm::recv(p);
+    let value: int = core::oldcomm::recv(p);
     log(debug, value);
 }
 
@@ -93,22 +93,22 @@ fn test04() {
     debug!("Finishing up.");
 }
 
-fn test05_start(ch: core::comm::Chan<int>) {
-    core::comm::send(ch, 10);
-    core::comm::send(ch, 20);
-    core::comm::send(ch, 30);
-    core::comm::send(ch, 30);
-    core::comm::send(ch, 30);
+fn test05_start(ch: core::oldcomm::Chan<int>) {
+    core::oldcomm::send(ch, 10);
+    core::oldcomm::send(ch, 20);
+    core::oldcomm::send(ch, 30);
+    core::oldcomm::send(ch, 30);
+    core::oldcomm::send(ch, 30);
 }
 
 fn test05() {
-    let po = core::comm::Port();
-    let ch = core::comm::Chan(&po);
+    let po = core::oldcomm::Port();
+    let ch = core::oldcomm::Chan(&po);
     task::spawn(|| test05_start(ch) );
     let mut value: int;
-    value = core::comm::recv(po);
-    value = core::comm::recv(po);
-    value = core::comm::recv(po);
+    value = core::oldcomm::recv(po);
+    value = core::oldcomm::recv(po);
+    value = core::oldcomm::recv(po);
     log(debug, value);
 }
 
index a1d9d3aa4119f1f6b75c9679dfa8ae777d20f057..fd45910ee88faca6e2d3fa5899195f71d2c1deb4 100644 (file)
@@ -18,7 +18,7 @@
 fn child() { }
 
 struct notify {
-    ch: comm::Chan<bool>, v: @mut bool,
+    ch: oldcomm::Chan<bool>, v: @mut bool,
 }
 
 impl notify : Drop {
@@ -29,19 +29,19 @@ fn finalize(&self) {
                task::failing(),
                *(self.v));
         let b = *(self.v);
-        comm::send(self.ch, b);
+        oldcomm::send(self.ch, b);
     }
 }
 
-fn notify(ch: comm::Chan<bool>, v: @mut bool) -> notify {
+fn notify(ch: oldcomm::Chan<bool>, v: @mut bool) -> notify {
     notify {
         ch: ch,
         v: v
     }
 }
 
-fn joinable(+f: fn~()) -> comm::Port<bool> {
-    fn wrapper(+c: comm::Chan<bool>, +f: fn()) {
+fn joinable(+f: fn~()) -> oldcomm::Port<bool> {
+    fn wrapper(+c: oldcomm::Chan<bool>, +f: fn()) {
         let b = @mut false;
         error!("wrapper: task=%? allocated v=%x",
                task::get_task(),
@@ -50,14 +50,14 @@ fn wrapper(+c: comm::Chan<bool>, +f: fn()) {
         f();
         *b = true;
     }
-    let p = comm::Port();
-    let c = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
     do task::spawn_unlinked { wrapper(c, copy f) };
     p
 }
 
-fn join(port: comm::Port<bool>) -> bool {
-    comm::recv(port)
+fn join(port: oldcomm::Port<bool>) -> bool {
+    oldcomm::recv(port)
 }
 
 fn main() {
@@ -76,15 +76,15 @@ fn main() {
     let p1;
     let p2;
 
-    p1 = comm::Port::<int>();
-    p2 = comm::Port::<int>();
+    p1 = oldcomm::Port::<int>();
+    p2 = oldcomm::Port::<int>();
 
     assert (p1 == p1);
     assert (p1 != p2);
 
     // channels
-    let c1 = comm::Chan(p1);
-    let c2 = comm::Chan(p2);
+    let c1 = oldcomm::Chan(p1);
+    let c2 = oldcomm::Chan(p2);
 
     assert (c1 == c1);
     assert (c1 != c2);
index 2fe24a7b38e33c0bca7d46c0656c4a3cbf41899a..029bab51770d4449594f7202d980df0e8781b1fb 100644 (file)
@@ -14,7 +14,7 @@
 // the join.
 
 struct notify {
-    ch: comm::Chan<bool>, v: @mut bool,
+    ch: oldcomm::Chan<bool>, v: @mut bool,
 }
 
 impl notify : Drop {
@@ -25,19 +25,19 @@ fn finalize(&self) {
                task::failing(),
                *(self.v));
         let b = *(self.v);
-        comm::send(self.ch, b);
+        oldcomm::send(self.ch, b);
     }
 }
 
-fn notify(ch: comm::Chan<bool>, v: @mut bool) -> notify {
+fn notify(ch: oldcomm::Chan<bool>, v: @mut bool) -> notify {
     notify {
         ch: ch,
         v: v
     }
 }
 
-fn joinable(+f: fn~()) -> comm::Port<bool> {
-    fn wrapper(+c: comm::Chan<bool>, +f: fn()) {
+fn joinable(+f: fn~()) -> oldcomm::Port<bool> {
+    fn wrapper(+c: oldcomm::Chan<bool>, +f: fn()) {
         let b = @mut false;
         error!("wrapper: task=%? allocated v=%x",
                task::get_task(),
@@ -46,14 +46,14 @@ fn wrapper(+c: comm::Chan<bool>, +f: fn()) {
         f();
         *b = true;
     }
-    let p = comm::Port();
-    let c = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
     do task::spawn_unlinked { wrapper(c, f) };
     p
 }
 
-fn join(port: comm::Port<bool>) -> bool {
-    comm::recv(port)
+fn join(port: oldcomm::Port<bool>) -> bool {
+    oldcomm::recv(port)
 }
 
 fn supervised() {
index d9dadddf13756e3495cf956d92f69044b8f0c95e..4ee2413ab197ee42424060c6ab46b6c23bff472c 100644 (file)
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 fn main() {
-    let p = comm::Port::<uint>();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port::<uint>();
+    let ch = oldcomm::Chan(&p);
 
     let x = ~1;
     let x_in_parent = ptr::addr_of(&(*x)) as uint;
@@ -20,17 +20,17 @@ fn main() {
 
     task::spawn(fn~(copy ch, copy y, move x) {
         let x_in_child = ptr::addr_of(&(*x)) as uint;
-        comm::send(ch, x_in_child);
+        oldcomm::send(ch, x_in_child);
 
         let y_in_child = ptr::addr_of(&(*y)) as uint;
-        comm::send(ch, y_in_child);
+        oldcomm::send(ch, y_in_child);
     });
     // Ensure last-use analysis doesn't move y to child.
     let _q = y;
 
-    let x_in_child = comm::recv(p);
+    let x_in_child = oldcomm::recv(p);
     assert x_in_parent == x_in_child;
 
-    let y_in_child = comm::recv(p);
+    let y_in_child = oldcomm::recv(p);
     assert y_in_parent != y_in_child;
 }
index 299470e6cf926ddaa641d6041e85eae92d145cb6..c1709f2ca23d10f18bb59819a62deb01b20f7ea8 100644 (file)
 
 extern mod std;
 
-fn child(c: comm::Chan<~uint>, i: uint) {
-    comm::send(c, ~i);
+fn child(c: oldcomm::Chan<~uint>, i: uint) {
+    oldcomm::send(c, ~i);
 }
 
 fn main() {
-    let p = comm::Port();
-    let ch = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let ch = oldcomm::Chan(&p);
     let n = 100u;
     let mut expected = 0u;
     for uint::range(0u, n) |i| {
@@ -26,7 +26,7 @@ fn main() {
 
     let mut actual = 0u;
     for uint::range(0u, n) |_i| {
-        let j = comm::recv(p);
+        let j = oldcomm::recv(p);
         actual += *j;
     }
 
index 47125c367d5536f4e0567ca3f82524d629431349..6bbfabc875703b2cdf464991f5bebe2761cfa819 100644 (file)
@@ -11,9 +11,9 @@
 extern mod std;
 
 fn main() {
-    let p = comm::Port();
-    let c = comm::Chan(&p);
-    comm::send(c, ~100);
-    let v = comm::recv(p);
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
+    oldcomm::send(c, ~100);
+    let v = oldcomm::recv(p);
     assert v == ~100;
 }
\ No newline at end of file
index 09070b7e7e2c42e13128658f35bf8d1e97a60b03..263ac090c99c3c900185b610599d5ee0940a34e2 100644 (file)
 extern mod std;
 
 struct complainer {
-  c: comm::Chan<bool>,
+  c: oldcomm::Chan<bool>,
 }
 
 impl complainer : Drop {
     fn finalize(&self) {
         error!("About to send!");
-        comm::send(self.c, true);
+        oldcomm::send(self.c, true);
         error!("Sent!");
     }
 }
 
-fn complainer(c: comm::Chan<bool>) -> complainer {
+fn complainer(c: oldcomm::Chan<bool>) -> complainer {
     error!("Hello!");
     complainer {
         c: c
     }
 }
 
-fn f(c: comm::Chan<bool>) {
+fn f(c: oldcomm::Chan<bool>) {
     let _c = move complainer(c);
     fail;
 }
 
 fn main() {
-    let p = comm::Port();
-    let c = comm::Chan(&p);
+    let p = oldcomm::Port();
+    let c = oldcomm::Chan(&p);
     task::spawn_unlinked(|| f(c) );
     error!("hiiiiiiiii");
-    assert comm::recv(p);
+    assert oldcomm::recv(p);
 }
index 0c342bf1b2b36e06cb294464abf886619e4a326a..86df25d54963fa1d5f2793745336977cc7f5fab7 100644 (file)
@@ -15,7 +15,7 @@ enum crew_of_enterprise_d {
     #[captain]
     jean_luc_picard,
 
-    #[commander]
+    #[oldcommander]
     william_t_riker,
 
     #[chief_medical_officer]
@@ -24,7 +24,7 @@ enum crew_of_enterprise_d {
     #[ships_councellor]
     deanna_troi,
 
-    #[lieutenant_commander]
+    #[lieutenant_oldcommander]
     data,
 
     #[chief_of_security]