Permalink
Browse files

De-mode comm::Chan

  • Loading branch information...
1 parent 777baeb commit fe12da0864ade257eb9b7cffbb96e5cb24af325e @catamorphism catamorphism committed Oct 3, 2012
Showing with 173 additions and 173 deletions.
  1. +3 −3 doc/rust.md
  2. +22 −22 src/libcore/comm.rs
  3. +2 −2 src/libcore/option.rs
  4. +3 −3 src/libcore/os.rs
  5. +8 −8 src/libcore/private.rs
  6. +1 −1 src/libcore/run.rs
  7. +21 −21 src/libcore/task.rs
  8. +1 −1 src/libcore/task/spawn.rs
  9. +15 −15 src/libstd/net_tcp.rs
  10. +2 −2 src/libstd/sync.rs
  11. +5 −5 src/libstd/test.rs
  12. +5 −5 src/libstd/timer.rs
  13. +5 −5 src/libstd/uv_global_loop.rs
  14. +4 −4 src/libstd/uv_iotask.rs
  15. +3 −3 src/libstd/uv_ll.rs
  16. +1 −1 src/rustc/driver/rustc.rs
  17. +1 −1 src/rustdoc/astsrv.rs
  18. +4 −4 src/rustdoc/markdown_writer.rs
  19. +1 −1 src/test/auxiliary/cci_capture_clause.rs
  20. +3 −3 src/test/bench/msgsend-ring.rs
  21. +2 −2 src/test/bench/shootout-chameneos-redux.rs
  22. +1 −1 src/test/bench/shootout-k-nucleotide.rs
  23. +2 −2 src/test/bench/shootout-mandelbrot.rs
  24. +1 −1 src/test/bench/shootout-threadring.rs
  25. +1 −1 src/test/bench/task-perf-linked-failure.rs
  26. +2 −2 src/test/bench/task-perf-one-million.rs
  27. +3 −3 src/test/bench/task-perf-word-count-generic.rs
  28. +1 −1 src/test/compile-fail/issue-3096-2.rs
  29. +1 −1 src/test/compile-fail/non-copyable-void.rs
  30. +1 −1 src/test/compile-fail/unsendable-class.rs
  31. +1 −1 src/test/run-fail/port-type.rs
  32. +1 −1 src/test/run-pass/basic-1.rs
  33. +1 −1 src/test/run-pass/basic-2.rs
  34. +1 −1 src/test/run-pass/basic.rs
  35. +1 −1 src/test/run-pass/capture_nil.rs
  36. +3 −3 src/test/run-pass/chan-leak.rs
  37. +1 −1 src/test/run-pass/comm.rs
  38. +1 −1 src/test/run-pass/decl-with-recv.rs
  39. +2 −2 src/test/run-pass/hashmap-memory.rs
  40. +1 −1 src/test/run-pass/issue-507.rs
  41. +3 −3 src/test/run-pass/issue-687.rs
  42. +2 −2 src/test/run-pass/issue-783.rs
  43. +1 −1 src/test/run-pass/ivec-tag.rs
  44. +1 −1 src/test/run-pass/lazychan.rs
  45. +2 −2 src/test/run-pass/many.rs
  46. +6 −6 src/test/run-pass/rt-circular-buffer.rs
  47. +1 −1 src/test/run-pass/rt-sched-1.rs
  48. +1 −1 src/test/run-pass/send-iloop.rs
  49. +2 −2 src/test/run-pass/send-resource.rs
  50. +1 −1 src/test/run-pass/send-type-inference.rs
  51. +1 −1 src/test/run-pass/sendable-class.rs
  52. +1 −1 src/test/run-pass/spawn-types.rs
  53. +1 −1 src/test/run-pass/task-comm-chan-cleanup.rs
  54. +1 −1 src/test/run-pass/task-comm-chan-cleanup2.rs
  55. +1 −1 src/test/run-pass/task-comm-chan-cleanup3.rs
  56. +1 −1 src/test/run-pass/task-comm-chan-cleanup4.rs
  57. +1 −1 src/test/run-pass/task-comm-chan-nil.rs
  58. +3 −3 src/test/run-pass/task-comm.rs
  59. +1 −1 src/test/run-pass/task-killjoin-rsrc.rs
  60. +1 −1 src/test/run-pass/task-spawn-move-and-copy.rs
  61. +1 −1 src/test/run-pass/unique-send-2.rs
  62. +1 −1 src/test/run-pass/unique-send.rs
  63. +1 −1 src/test/run-pass/unwind-resource.rs
View
@@ -2952,7 +2952,7 @@ An example of a `spawn` call:
~~~~
let po = comm::Port();
-let ch = comm::Chan(po);
+let ch = comm::Chan(&po);
do task::spawn {
// let task run, do other things
@@ -2974,7 +2974,7 @@ An example of a send:
~~~~
let po = comm::Port();
-let ch = comm::Chan(po);
+let ch = comm::Chan(&po);
comm::send(ch, ~"hello, world");
~~~~
@@ -2990,7 +2990,7 @@ An example of a *receive*:
~~~~~~~~
# let po = comm::Port();
-# let ch = comm::Chan(po);
+# let ch = comm::Chan(&po);
# comm::send(ch, ~"");
let s = comm::recv(po);
~~~~~~~~
View
@@ -32,8 +32,8 @@ will once again be the preferred module for intertask communication.
*/
-// NB: transitionary, de-mode-ing
-// tjc: re-forbid deprecated modes after snapshot
+// NB: transitionary, de-mode-ing.
+#[forbid(deprecated_mode)];
#[forbid(deprecated_pattern)];
use either::Either;
@@ -74,7 +74,7 @@ pub fn Port<T: Send>() -> Port<T> {
impl<T: Send> Port<T> {
- fn chan() -> Chan<T> { Chan(self) }
+ 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) }
@@ -166,7 +166,7 @@ fn as_raw_port<T: Send, U>(ch: comm::Chan<T>, f: fn(*rust_port) -> U) -> U {
* Constructs a channel. The channel is bound to the port used to
* construct it.
*/
-pub fn Chan<T: Send>(&&p: Port<T>) -> Chan<T> {
+pub fn Chan<T: Send>(p: &Port<T>) -> Chan<T> {
Chan_(rustrt::get_port_id((**p).po))
}
@@ -304,51 +304,51 @@ extern mod rusti {
#[test]
-fn create_port_and_chan() { let p = Port::<int>(); Chan(p); }
+fn create_port_and_chan() { let p = Port::<int>(); Chan(&p); }
#[test]
fn send_int() {
let p = Port::<int>();
- let c = Chan(p);
+ let c = Chan(&p);
send(c, 22);
}
#[test]
fn send_recv_fn() {
let p = Port::<int>();
- let c = Chan::<int>(p);
+ 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);
+ 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));
+ 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));
+ let c = Chan(&p);
+ send(c, Chan(&p2));
recv(p);
}
#[test]
fn test_peek() {
let po = Port();
- let ch = Chan(po);
+ let ch = Chan(&po);
assert !peek(po);
send(ch, ());
assert peek(po);
@@ -360,8 +360,8 @@ fn test_peek() {
fn test_select2_available() {
let po_a = Port();
let po_b = Port();
- let ch_a = Chan(po_a);
- let ch_b = Chan(po_b);
+ let ch_a = Chan(&po_a);
+ let ch_b = Chan(&po_b);
send(ch_a, ~"a");
@@ -376,8 +376,8 @@ fn test_select2_available() {
fn test_select2_rendezvous() {
let po_a = Port();
let po_b = Port();
- let ch_a = Chan(po_a);
- let ch_b = Chan(po_b);
+ let ch_a = Chan(&po_a);
+ let ch_b = Chan(&po_b);
for iter::repeat(10) {
do task::spawn {
@@ -400,8 +400,8 @@ fn test_select2_rendezvous() {
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 ch_a = Chan(&po_a);
+ let ch_b = Chan(&po_b);
let msgs = 100;
let times = 4u;
@@ -436,7 +436,7 @@ fn test_select2_stress() {
#[test]
fn test_recv_chan() {
let po = Port();
- let ch = Chan(po);
+ let ch = Chan(&po);
send(ch, ~"flower");
assert recv_chan(ch) == ~"flower";
}
@@ -445,7 +445,7 @@ fn test_recv_chan() {
#[should_fail]
#[ignore(cfg(windows))]
fn test_recv_chan_dead() {
- let ch = Chan(Port());
+ let ch = Chan(&Port());
send(ch, ~"flower");
recv_chan(ch);
}
@@ -454,7 +454,7 @@ fn test_recv_chan_dead() {
#[ignore(cfg(windows))]
fn test_recv_chan_wrong_task() {
let po = Port();
- let ch = Chan(po);
+ let ch = Chan(&po);
send(ch, ~"flower");
assert result::is_err(&task::try(||
recv_chan(ch)
View
@@ -326,10 +326,10 @@ impl<T: Eq> Option<T> : Eq {
#[test]
fn test_unwrap_ptr() {
let x = ~0;
- let addr_x = ptr::p2::addr_of(&(*x));
+ let addr_x = ptr::addr_of(&(*x));
let opt = Some(x);
let y = unwrap(opt);
- let addr_y = ptr::p2::addr_of(&(*y));
+ let addr_y = ptr::addr_of(&(*y));
assert addr_x == addr_y;
}
View
@@ -132,7 +132,7 @@ mod global_env {
let env_ch = get_global_env_chan();
let po = comm::Port();
comm::send(env_ch, MsgGetEnv(str::from_slice(n),
- comm::Chan(po)));
+ comm::Chan(&po)));
comm::recv(po)
}
@@ -141,14 +141,14 @@ mod global_env {
let po = comm::Port();
comm::send(env_ch, MsgSetEnv(str::from_slice(n),
str::from_slice(v),
- comm::Chan(po)));
+ comm::Chan(&po)));
comm::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::send(env_ch, MsgEnv(comm::Chan(&po)));
comm::recv(po)
}
View
@@ -63,7 +63,7 @@ pub unsafe fn chan_from_global_ptr<T: Send>(
let (setup_po, setup_ch) = do task_fn().spawn_conversation
|move f, setup_po, setup_ch| {
let po = comm::Port::<T>();
- let ch = comm::Chan(po);
+ let ch = comm::Chan(&po);
comm::send(setup_ch, ch);
// Wait to hear if we are the official instance of
@@ -109,7 +109,7 @@ pub fn test_from_global_chan1() {
// The global channel
let globchan = 0;
- let globchanp = ptr::p2::addr_of(&globchan);
+ let globchanp = ptr::addr_of(&globchan);
// Create the global channel, attached to a new task
let ch = unsafe {
@@ -122,7 +122,7 @@ pub fn test_from_global_chan1() {
};
// Talk to it
let po = comm::Port();
- comm::send(ch, comm::Chan(po));
+ comm::send(ch, comm::Chan(&po));
assert comm::recv(po) == true;
// This one just reuses the previous channel
@@ -135,7 +135,7 @@ pub fn test_from_global_chan1() {
// Talk to the original global task
let po = comm::Port();
- comm::send(ch, comm::Chan(po));
+ comm::send(ch, comm::Chan(&po));
assert comm::recv(po) == true;
}
@@ -145,10 +145,10 @@ pub fn test_from_global_chan2() {
for iter::repeat(100) {
// The global channel
let globchan = 0;
- let globchanp = ptr::p2::addr_of(&globchan);
+ let globchanp = ptr::addr_of(&globchan);
let resultpo = comm::Port();
- let resultch = comm::Chan(resultpo);
+ let resultch = comm::Chan(&resultpo);
// Spawn a bunch of tasks that all want to compete to
// create the global channel
@@ -165,7 +165,7 @@ pub fn test_from_global_chan2() {
}
};
let po = comm::Port();
- comm::send(ch, comm::Chan(po));
+ comm::send(ch, comm::Chan(&po));
// We are The winner if our version of the
// task was installed
let winner = comm::recv(po);
@@ -203,7 +203,7 @@ pub fn test_from_global_chan2() {
*/
pub unsafe fn weaken_task(f: fn(comm::Port<()>)) {
let po = comm::Port();
- let ch = comm::Chan(po);
+ let ch = comm::Chan(&po);
unsafe {
rustrt::rust_task_weaken(cast::reinterpret_cast(&ch));
}
View
@@ -296,7 +296,7 @@ pub fn program_output(prog: &str, args: &[~str]) ->
// 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 ch = comm::Chan(&p);
do task::spawn_sched(task::SingleThreaded) {
let errput = readclose(pipe_err.in);
comm::send(ch, (2, move errput));
Oops, something went wrong.

0 comments on commit fe12da0

Please sign in to comment.