diff --git a/doc/tutorial.md b/doc/tutorial.md index ab66456be02e6..54caad0682208 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -2975,9 +2975,9 @@ the string in response. The child terminates when `0` is received. Here is the function that implements the child task: ~~~~ -# import comm::{port, chan}; -fn stringifier(from_parent: port, - to_parent: chan<~str>) { +# import comm::{Port, port, Chan, chan}; +fn stringifier(from_parent: Port, + to_parent: Chan<~str>) { let mut value: uint; loop { value = from_parent.recv(); @@ -2999,9 +2999,9 @@ Here is the code for the parent task: ~~~~ # import task::{spawn_conversation}; -# import comm::{chan, port}; -# fn stringifier(from_parent: comm::port, -# to_parent: comm::chan<~str>) { +# import comm::{Chan, chan, Port, port}; +# fn stringifier(from_parent: comm::Port, +# to_parent: comm::Chan<~str>) { # comm::send(to_parent, ~"22"); # comm::send(to_parent, ~"23"); # comm::send(to_parent, ~"0"); diff --git a/src/compiletest/procsrv.rs b/src/compiletest/procsrv.rs index d5cddf0a4e0d9..aab08ffffe787 100644 --- a/src/compiletest/procsrv.rs +++ b/src/compiletest/procsrv.rs @@ -62,12 +62,12 @@ fn run(lib_path: ~str, writeclose(pipe_in.out, input); let p = pipes::port_set(); let ch = p.chan(); - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { let errput = readclose(pipe_err.in); ch.send((2, errput)); } let ch = p.chan(); - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { let output = readclose(pipe_out.in); ch.send((1, output)); } diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index eb19a12c254b0..6452027fa7c4e 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -30,8 +30,8 @@ import either::Either; import libc::size_t; -export port; -export chan; +export Port, port; +export Chan, chan; export send; export recv; export peek; @@ -48,8 +48,8 @@ export listen; * transmitted. If a port value is copied, both copies refer to the same * port. Ports may be associated with multiple `chan`s. */ -enum port { - port_t(@port_ptr) +enum Port { + Port_(@PortPtr) } // It's critical that this only have one variant, so it has a record @@ -64,27 +64,27 @@ enum port { * data will be silently dropped. Channels may be duplicated and * themselves transmitted over other channels. */ -enum chan { - chan_t(port_id) +enum Chan { + Chan_(port_id) } /// Constructs a port -fn port() -> port { - port_t(@port_ptr(rustrt::new_port(sys::size_of::() as size_t))) +fn port() -> Port { + Port_(@PortPtr(rustrt::new_port(sys::size_of::() as size_t))) } -impl port { +impl Port { - fn chan() -> chan { chan(self) } + fn chan() -> Chan { chan(self) } fn send(+v: T) { self.chan().send(v) } fn recv() -> T { recv(self) } fn peek() -> bool { peek(self) } } -impl chan { +impl Chan { - fn chan() -> chan { self } + fn chan() -> Chan { self } fn send(+v: T) { send(self, v) } fn recv() -> T { recv_chan(self) } fn peek() -> bool { peek_chan(self) } @@ -92,12 +92,12 @@ impl chan { } /// Open a new receiving channel for the duration of a function -fn listen(f: fn(chan) -> U) -> U { +fn listen(f: fn(Chan) -> U) -> U { let po = port(); f(po.chan()) } -class port_ptr { +class PortPtr { let po: *rust_port; new(po: *rust_port) { self.po = po; } drop unsafe { @@ -130,9 +130,9 @@ class port_ptr { * Fails if the port is detached or dead. Fails if the port * is owned by a different task. */ -fn as_raw_port(ch: comm::chan, f: fn(*rust_port) -> U) -> U { +fn as_raw_port(ch: comm::Chan, f: fn(*rust_port) -> U) -> U { - class portref { + class PortRef { let p: *rust_port; new(p: *rust_port) { self.p = p; } drop { @@ -142,7 +142,7 @@ fn as_raw_port(ch: comm::chan, f: fn(*rust_port) -> U) -> U { } } - let p = portref(rustrt::rust_port_take(*ch)); + let p = PortRef(rustrt::rust_port_take(*ch)); if ptr::is_null(p.p) { fail ~"unable to locate port for channel" @@ -157,16 +157,16 @@ fn as_raw_port(ch: comm::chan, f: fn(*rust_port) -> U) -> U { * Constructs a channel. The channel is bound to the port used to * construct it. */ -fn chan(p: port) -> chan { - chan_t(rustrt::get_port_id((**p).po)) +fn chan(p: Port) -> Chan { + 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. */ -fn send(ch: chan, +data: T) { - let chan_t(p) = ch; +fn send(ch: Chan, +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 != 0u unsafe { @@ -180,17 +180,17 @@ fn send(ch: chan, +data: T) { * Receive from a port. If no data is available on the port then the * task will block until data becomes available. */ -fn recv(p: port) -> T { recv_((**p).po) } +fn recv(p: Port) -> T { recv_((**p).po) } /// Returns true if there are messages available -fn peek(p: port) -> bool { peek_((**p).po) } +fn peek(p: Port) -> bool { peek_((**p).po) } #[doc(hidden)] -fn recv_chan(ch: comm::chan) -> T { +fn recv_chan(ch: comm::Chan) -> T { as_raw_port(ch, |x|recv_(x)) } -fn peek_chan(ch: comm::chan) -> bool { +fn peek_chan(ch: comm::Chan) -> bool { as_raw_port(ch, |x|peek_(x)) } @@ -221,7 +221,7 @@ fn peek_(p: *rust_port) -> bool { } /// Receive on one of two ports -fn select2(p_a: port, p_b: port) +fn select2(p_a: Port, p_b: Port) -> Either { let ports = ~[(**p_a).po, (**p_b).po]; let yield = 0u, yieldp = ptr::addr_of(yield); @@ -257,9 +257,10 @@ fn select2(p_a: port, p_b: port) /* 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"] @@ -329,7 +330,7 @@ fn chan_chan_infer() { #[test] fn chan_chan() { - let p = port::>(), p2 = port::(); + let p = port::>(), p2 = port::(); let c = chan(p); send(c, chan(p2)); recv(p); diff --git a/src/libcore/core.rc b/src/libcore/core.rc index 3c54e077cc3a8..cd87313c696f4 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -235,8 +235,11 @@ mod dlist_iter { mod send_map; // Concurrency +#[warn(non_camel_case_types)] mod comm; +#[warn(non_camel_case_types)] mod task; +//#[warn(non_camel_ase_types)] pipec code continues to trip this warning mod future; mod pipes; diff --git a/src/libcore/future.rs b/src/libcore/future.rs index a935a50ddb6bb..fb3d832aef53c 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -18,7 +18,7 @@ import either::Either; import pipes::recv; -export future; +export Future; export extensions; export from_value; export from_port; @@ -31,12 +31,12 @@ export spawn; export future_pipe; #[doc = "The future type"] -enum future = { +enum Future = { mut v: Either<@A, fn@() -> A> }; /// Methods on the `future` type -impl future { +impl Future { fn get() -> A { //! Get the value of the future @@ -51,7 +51,7 @@ impl future { } } -fn from_value(+val: A) -> future { +fn from_value(+val: A) -> Future { /*! * Create a future from a value * @@ -59,7 +59,7 @@ fn from_value(+val: A) -> future { * not block. */ - future({ + Future({ mut v: either::Left(@val) }) } @@ -68,7 +68,7 @@ macro_rules! move_it { {$x:expr} => { unsafe { let y <- *ptr::addr_of($x); y } } } -fn from_port(+port: future_pipe::client::waiting) -> future { +fn from_port(+port: future_pipe::client::waiting) -> Future { #[doc = " Create a future from a port @@ -87,7 +87,7 @@ fn from_port(+port: future_pipe::client::waiting) -> future { } } -fn from_fn(f: fn@() -> A) -> future { +fn from_fn(f: fn@() -> A) -> Future { /*! * Create a future from a function. * @@ -96,12 +96,12 @@ fn from_fn(f: fn@() -> A) -> future { * function. It is not spawned into another task. */ - future({ + Future({ mut v: either::Right(f) }) } -fn spawn(+blk: fn~() -> A) -> future { +fn spawn(+blk: fn~() -> A) -> Future { /*! * Create a future from a unique closure. * @@ -114,13 +114,13 @@ fn spawn(+blk: fn~() -> A) -> future { })) } -fn get(future: &future) -> A { +fn get(future: &Future) -> A { //! Get the value of the future do with(future) |v| { *v } } -fn with(future: &future, blk: fn((&A)) -> B) -> B { +fn with(future: &Future, blk: fn((&A)) -> B) -> B { //! Work with the value without copying it let v = match copy future.v { diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 7d5e98c08bd84..329172bb69ad9 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -24,7 +24,7 @@ import option::{some, none}; import getcwd = rustrt::rust_getcwd; import consts::*; -import task::task_builder; +import task::TaskBuilder; export close, fclose, fsync_fd, waitpid; export env, getenv, setenv, fdopen, pipe; @@ -135,9 +135,9 @@ mod global_env { } enum Msg { - MsgGetEnv(~str, comm::chan>), - MsgSetEnv(~str, ~str, comm::chan<()>), - MsgEnv(comm::chan<~[(~str,~str)]>) + MsgGetEnv(~str, comm::Chan>), + MsgSetEnv(~str, ~str, comm::Chan<()>), + MsgEnv(comm::Chan<~[(~str,~str)]>) } fn getenv(n: ~str) -> option<~str> { @@ -161,18 +161,18 @@ mod global_env { comm::recv(po) } - fn get_global_env_chan() -> comm::chan { + fn get_global_env_chan() -> comm::Chan { let global_ptr = rustrt::rust_global_env_chan_ptr(); unsafe { priv::chan_from_global_ptr(global_ptr, || { // FIXME (#2621): This would be a good place to use a very // small foreign stack - task::task().sched_mode(task::single_threaded).unlinked() + task::task().sched_mode(task::SingleThreaded).unlinked() }, global_env_task) } } - fn global_env_task(msg_po: comm::port) { + fn global_env_task(msg_po: comm::Port) { unsafe { do priv::weaken_task |weak_po| { loop { diff --git a/src/libcore/priv.rs b/src/libcore/priv.rs index 01a7936ca26a5..1fcc57f503642 100644 --- a/src/libcore/priv.rs +++ b/src/libcore/priv.rs @@ -7,7 +7,7 @@ export chan_from_global_ptr, weaken_task; import compare_and_swap = rustrt::rust_compare_and_swap_ptr; -import task::task_builder; +import task::TaskBuilder; #[allow(non_camel_case_types)] // runtime type type rust_port_id = uint; @@ -29,9 +29,9 @@ type GlobalPtr = *libc::uintptr_t; */ unsafe fn chan_from_global_ptr( global: GlobalPtr, - task_fn: fn() -> task::task_builder, - +f: fn~(comm::port) -) -> comm::chan { + task_fn: fn() -> task::TaskBuilder, + +f: fn~(comm::Port) +) -> comm::Chan { enum Msg { Proceed, @@ -185,7 +185,7 @@ 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. */ -unsafe fn weaken_task(f: fn(comm::port<()>)) { +unsafe fn weaken_task(f: fn(comm::Port<()>)) { let po = comm::port(); let ch = comm::chan(po); unsafe { @@ -195,8 +195,8 @@ unsafe fn weaken_task(f: fn(comm::port<()>)) { f(po); class Unweaken { - let ch: comm::chan<()>; - new(ch: comm::chan<()>) { self.ch = ch; } + let ch: comm::Chan<()>; + new(ch: comm::Chan<()>) { self.ch = ch; } drop unsafe { rustrt::rust_task_unweaken(unsafe::reinterpret_cast(self.ch)); } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 2c3ff0121ba1a..5dcd0a5272443 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -173,9 +173,9 @@ impl *T: Ptr { #[test] fn test() { unsafe { - type pair = {mut fst: int, mut snd: int}; + type Pair = {mut fst: int, mut snd: int}; let p = {mut fst: 10, mut snd: 20}; - let pptr: *mut pair = mut_addr_of(p); + let pptr: *mut Pair = mut_addr_of(p); let iptr: *mut int = unsafe::reinterpret_cast(pptr); assert (*iptr == 10);; *iptr = 30; diff --git a/src/libcore/run.rs b/src/libcore/run.rs index 7b08bb8f96b5d..991c4d8bed2f8 100644 --- a/src/libcore/run.rs +++ b/src/libcore/run.rs @@ -298,11 +298,11 @@ fn program_output(prog: &str, args: &[~str]) -> // clever way to do this. let p = comm::port(); let ch = comm::chan(p); - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { let errput = readclose(pipe_err.in); comm::send(ch, (2, errput)); }; - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { let output = readclose(pipe_out.in); comm::send(ch, (1, output)); }; diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 678cda3240430..50ff4e0d8a25b 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -29,14 +29,15 @@ import result::result; -export task; -export task_result; -export notification; -export sched_mode; -export sched_opts; -export task_opts; -export task_builder; +export Task; +export TaskResult; +export Notification; +export SchedMode; +export SchedOpts; +export TaskOpts; +export TaskBuilder; +export task; export default_task_opts; export get_opts; export set_opts; @@ -69,16 +70,16 @@ export local_data_get; export local_data_set; export local_data_modify; -export single_threaded; -export thread_per_core; -export thread_per_task; -export manual_threads; -export platform_thread; +export SingleThreaded; +export ThreadPerCore; +export ThreadPerTask; +export ManualThreads; +export PlatformThread; /* Data types */ /// A handle to a task -enum task { task_handle(task_id) } +enum Task { TaskHandle(task_id) } /** * Indicates the manner in which a task exited. @@ -91,34 +92,34 @@ enum task { task_handle(task_id) } * If you wish for this result's delivery to block until all linked and/or * children tasks complete, recommend using a result future. */ -enum task_result { - success, - failure, +enum TaskResult { + Success, + Failure, } /// A message type for notifying of task lifecycle events -enum notification { +enum Notification { /// Sent when a task exits with the task handle and result - exit(task, task_result) + Exit(Task, TaskResult) } /// Scheduler modes -enum sched_mode { +enum SchedMode { /// All tasks run in the same OS thread - single_threaded, + SingleThreaded, /// Tasks are distributed among available CPUs - thread_per_core, + ThreadPerCore, /// Each task runs in its own OS thread - thread_per_task, + ThreadPerTask, /// Tasks are distributed among a fixed number of OS threads - manual_threads(uint), + ManualThreads(uint), /** * Tasks are scheduled on the main OS thread * * The main OS thread is the thread used to launch the runtime which, * in most cases, is the process's initial thread as created by the OS. */ - platform_thread + PlatformThread } /** @@ -136,8 +137,8 @@ enum sched_mode { * default these foreign stacks have unspecified size, but with this * option their size can be precisely specified. */ -type sched_opts = { - mode: sched_mode, +type SchedOpts = { + mode: SchedMode, foreign_stack_size: option }; @@ -168,11 +169,11 @@ type sched_opts = { * into foreign code that blocks. Without doing so in a different * scheduler other tasks will be impeded or even blocked indefinitely. */ -type task_opts = { +type TaskOpts = { linked: bool, supervised: bool, - notify_chan: option>, - sched: option, + notify_chan: option>, + sched: option, }; /** @@ -189,8 +190,8 @@ type task_opts = { // the run function move them in. // FIXME (#2585): Replace the 'consumed' bit with move mode on self -enum task_builder = { - opts: task_opts, +enum TaskBuilder = { + opts: TaskOpts, gen_body: fn@(+fn~()) -> fn~(), can_not_copy: option, mut consumed: bool, @@ -201,8 +202,8 @@ enum task_builder = { * configuration methods can be chained. * For example, task().unlinked().spawn is equivalent to spawn_unlinked. */ -fn task() -> task_builder { - task_builder({ +fn task() -> TaskBuilder { + TaskBuilder({ opts: default_task_opts(), gen_body: |body| body, // Identity function can_not_copy: none, @@ -210,23 +211,23 @@ fn task() -> task_builder { }) } -priv impl task_builder { - fn consume() -> task_builder { +priv impl TaskBuilder { + fn consume() -> TaskBuilder { if self.consumed { fail ~"Cannot copy a task_builder"; // Fake move mode on self } self.consumed = true; - task_builder({ can_not_copy: none, mut consumed: false, with *self }) + TaskBuilder({ can_not_copy: none, mut consumed: false, with *self }) } } -impl task_builder { +impl TaskBuilder { /** * Decouple the child task's failure from the parent's. If either fails, * the other will not be killed. */ - fn unlinked() -> task_builder { - task_builder({ + fn unlinked() -> TaskBuilder { + TaskBuilder({ opts: { linked: false with self.opts }, can_not_copy: none, with *self.consume() @@ -237,8 +238,8 @@ impl task_builder { * child's failure will not kill the parent, but the parent's will kill * the child. */ - fn supervised() -> task_builder { - task_builder({ + fn supervised() -> TaskBuilder { + TaskBuilder({ opts: { linked: false, supervised: true with self.opts }, can_not_copy: none, with *self.consume() @@ -248,8 +249,8 @@ impl task_builder { * Link the child task's and parent task's failures. If either fails, the * other will be killed. */ - fn linked() -> task_builder { - task_builder({ + fn linked() -> TaskBuilder { + TaskBuilder({ opts: { linked: true, supervised: false with self.opts }, can_not_copy: none, with *self.consume() @@ -273,7 +274,7 @@ impl task_builder { * # Failure * Fails if a future_result was already set for this task. */ - fn future_result(blk: fn(+future::future)) -> task_builder { + fn future_result(blk: fn(+future::Future)) -> TaskBuilder { // FIXME (#1087, #1857): Once linked failure and notification are // handled in the library, I can imagine implementing this by just // registering an arbitrary number of task::on_exit handlers and @@ -284,25 +285,25 @@ impl task_builder { } // Construct the future and give it to the caller. - let po = comm::port::(); + let po = comm::port::(); let ch = comm::chan(po); blk(do future::from_fn { match comm::recv(po) { - exit(_, result) => result + Exit(_, result) => result } }); // Reconfigure self to use a notify channel. - task_builder({ + TaskBuilder({ opts: { notify_chan: some(ch) with self.opts }, can_not_copy: none, with *self.consume() }) } /// Configure a custom scheduler mode for the task. - fn sched_mode(mode: sched_mode) -> task_builder { - task_builder({ + fn sched_mode(mode: SchedMode) -> TaskBuilder { + TaskBuilder({ opts: { sched: some({ mode: mode, foreign_stack_size: none}) with self.opts }, can_not_copy: none, @@ -322,9 +323,9 @@ impl task_builder { * generator by applying the task body which results from the * existing body generator to the new body generator. */ - fn add_wrapper(wrapper: fn@(+fn~()) -> fn~()) -> task_builder { + fn add_wrapper(wrapper: fn@(+fn~()) -> fn~()) -> TaskBuilder { let prev_gen_body = self.gen_body; - task_builder({ + TaskBuilder({ gen_body: |body| { wrapper(prev_gen_body(body)) }, can_not_copy: none, with *self.consume() @@ -366,7 +367,7 @@ impl task_builder { * otherwise be required to establish communication from the parent * to the child. */ - fn spawn_listener(+f: fn~(comm::port)) -> comm::chan { + fn spawn_listener(+f: fn~(comm::Port)) -> comm::Chan { let setup_po = comm::port(); let setup_ch = comm::chan(setup_po); do self.spawn { @@ -382,8 +383,8 @@ impl task_builder { * Runs a new task, setting up communication in both directions */ fn spawn_conversation - (+f: fn~(comm::port, comm::chan)) - -> (comm::port, comm::chan) { + (+f: fn~(comm::Port, comm::Chan)) + -> (comm::Port, comm::Chan) { let from_child = comm::port(); let to_parent = comm::chan(from_child); let to_child = do self.spawn_listener |from_parent| { @@ -414,8 +415,8 @@ impl task_builder { comm::send(ch, f()); } match future::get(&option::unwrap(result)) { - success => result::ok(comm::recv(po)), - failure => result::err(()) + Success => result::ok(comm::recv(po)), + Failure => result::err(()) } } } @@ -423,7 +424,7 @@ impl task_builder { /* Task construction */ -fn default_task_opts() -> task_opts { +fn default_task_opts() -> TaskOpts { /*! * The default task options * @@ -486,7 +487,7 @@ fn spawn_with(+arg: A, +f: fn~(+A)) { task().spawn_with(arg, f) } -fn spawn_listener(+f: fn~(comm::port)) -> comm::chan { +fn spawn_listener(+f: fn~(comm::Port)) -> comm::Chan { /*! * Runs a new task while providing a channel from the parent to the child * @@ -497,8 +498,8 @@ fn spawn_listener(+f: fn~(comm::port)) -> comm::chan { } fn spawn_conversation - (+f: fn~(comm::port, comm::chan)) - -> (comm::port, comm::chan) { + (+f: fn~(comm::Port, comm::Chan)) + -> (comm::Port, comm::Chan) { /*! * Runs a new task, setting up communication in both directions * @@ -508,7 +509,7 @@ fn spawn_conversation task().spawn_conversation(f) } -fn spawn_sched(mode: sched_mode, +f: fn~()) { +fn spawn_sched(mode: SchedMode, +f: fn~()) { /*! * Creates a new scheduler and executes a task on it * @@ -555,10 +556,10 @@ fn failing() -> bool { rustrt::rust_task_is_unwinding(rustrt::rust_get_task()) } -fn get_task() -> task { +fn get_task() -> Task { //! Get a handle to the running task - task_handle(rustrt::get_task_id()) + TaskHandle(rustrt::get_task_id()) } /** @@ -577,28 +578,28 @@ fn get_task() -> task { * ~~~ */ unsafe fn unkillable(f: fn() -> U) -> U { - class allow_failure { + class AllowFailure { let t: *rust_task; new(t: *rust_task) { self.t = t; } drop { rustrt::rust_task_allow_kill(self.t); } } let t = rustrt::rust_get_task(); - let _allow_failure = allow_failure(t); + let _allow_failure = AllowFailure(t); rustrt::rust_task_inhibit_kill(t); f() } /// The inverse of unkillable. Only ever to be used nested in unkillable(). unsafe fn rekillable(f: fn() -> U) -> U { - class disallow_failure { + class DisallowFailure { let t: *rust_task; new(t: *rust_task) { self.t = t; } drop { rustrt::rust_task_inhibit_kill(self.t); } } let t = rustrt::rust_get_task(); - let _allow_failure = disallow_failure(t); + let _allow_failure = DisallowFailure(t); rustrt::rust_task_allow_kill(t); f() } @@ -608,7 +609,7 @@ unsafe fn rekillable(f: fn() -> U) -> U { * For use with exclusive ARCs, which use pthread mutexes directly. */ unsafe fn atomically(f: fn() -> U) -> U { - class defer_interrupts { + class DeferInterrupts { let t: *rust_task; new(t: *rust_task) { self.t = t; } drop { @@ -617,7 +618,7 @@ unsafe fn atomically(f: fn() -> U) -> U { } } let t = rustrt::rust_get_task(); - let _interrupts = defer_interrupts(t); + let _interrupts = DeferInterrupts(t); rustrt::rust_task_inhibit_kill(t); rustrt::rust_task_inhibit_yield(t); f() @@ -685,17 +686,21 @@ unsafe fn atomically(f: fn() -> U) -> U { * ****************************************************************************/ +#[allow(non_camel_case_types)] // runtime type type sched_id = int; +#[allow(non_camel_case_types)] // runtime type type task_id = int; // These are both opaque runtime/compiler types that we don't know the // structure of and should only deal with via unsafe pointer +#[allow(non_camel_case_types)] // runtime type type rust_task = libc::c_void; +#[allow(non_camel_case_types)] // runtime type type rust_closure = libc::c_void; -type taskset = send_map::linear::LinearMap<*rust_task,()>; +type TaskSet = send_map::linear::LinearMap<*rust_task,()>; -fn new_taskset() -> taskset { +fn new_taskset() -> TaskSet { pure fn task_hash(t: &*rust_task) -> uint { let task: *rust_task = *t; hash::hash_uint(task as uint) as uint @@ -708,33 +713,33 @@ fn new_taskset() -> taskset { send_map::linear::linear_map(task_hash, task_eq) } -fn taskset_insert(tasks: &mut taskset, task: *rust_task) { +fn taskset_insert(tasks: &mut TaskSet, task: *rust_task) { let didnt_overwrite = tasks.insert(task, ()); assert didnt_overwrite; } -fn taskset_remove(tasks: &mut taskset, task: *rust_task) { +fn taskset_remove(tasks: &mut TaskSet, task: *rust_task) { let was_present = tasks.remove(&task); assert was_present; } -fn taskset_each(tasks: &taskset, blk: fn(+*rust_task) -> bool) { +fn taskset_each(tasks: &TaskSet, blk: fn(+*rust_task) -> bool) { tasks.each_key(blk) } // One of these per group of linked-failure tasks. -type taskgroup_data = { +type TaskGroupData = { // All tasks which might kill this group. When this is empty, the group // can be "GC"ed (i.e., its link in the ancestor list can be removed). - mut members: taskset, + mut members: TaskSet, // All tasks unidirectionally supervised by (directly or transitively) // tasks in this group. - mut descendants: taskset, + mut descendants: TaskSet, }; -type taskgroup_arc = unsafe::Exclusive>; +type TaskGroupArc = unsafe::Exclusive>; -type taskgroup_inner = &mut option; +type TaskGroupInner = &mut option; // A taskgroup is 'dead' when nothing can cause it to fail; only members can. -pure fn taskgroup_is_dead(tg: &taskgroup_data) -> bool { +pure fn taskgroup_is_dead(tg: &TaskGroupData) -> bool { (&tg.members).is_empty() } @@ -745,7 +750,7 @@ pure fn taskgroup_is_dead(tg: &taskgroup_data) -> bool { // taskgroup which was spawned-unlinked. Tasks from intermediate generations // have references to the middle of the list; when intermediate generations // die, their node in the list will be collected at a descendant's spawn-time. -type ancestor_node = { +type AncestorNode = { // Since the ancestor list is recursive, we end up with references to // exclusives within other exclusives. This is dangerous business (if // circular references arise, deadlock and memory leaks are imminent). @@ -754,20 +759,20 @@ type ancestor_node = { // FIXME(#3068): Make the generation counter togglable with #[cfg(debug)]. generation: uint, // Should really be an immutable non-option. This way appeases borrowck. - mut parent_group: option, + mut parent_group: option, // Recursive rest of the list. - mut ancestors: ancestor_list, + mut ancestors: AncestorList, }; -enum ancestor_list = option>; +enum AncestorList = option>; // Accessors for taskgroup arcs and ancestor arcs that wrap the unsafety. #[inline(always)] -fn access_group(x: taskgroup_arc, blk: fn(taskgroup_inner) -> U) -> U { +fn access_group(x: TaskGroupArc, blk: fn(TaskGroupInner) -> U) -> U { unsafe { x.with(blk) } } #[inline(always)] -fn access_ancestors(x: unsafe::Exclusive, - blk: fn(x: &mut ancestor_node) -> U) -> U { +fn access_ancestors(x: unsafe::Exclusive, + blk: fn(x: &mut AncestorNode) -> U) -> U { unsafe { x.with(blk) } } @@ -779,21 +784,21 @@ fn access_ancestors(x: unsafe::Exclusive, // (3) As a bonus, coalesces away all 'dead' taskgroup nodes in the list. // FIXME(#2190): Change option to option, to save on // allocations. Once that bug is fixed, changing the sigil should suffice. -fn each_ancestor(list: &mut ancestor_list, - bail_opt: option, - forward_blk: fn(taskgroup_inner) -> bool) +fn each_ancestor(list: &mut AncestorList, + bail_opt: option, + forward_blk: fn(TaskGroupInner) -> bool) -> bool { // "Kickoff" call - there was no last generation. return !coalesce(list, bail_opt, forward_blk, uint::max_value); // Recursively iterates, and coalesces afterwards if needed. Returns // whether or not unwinding is needed (i.e., !successful iteration). - fn coalesce(list: &mut ancestor_list, - bail_opt: option, - forward_blk: fn(taskgroup_inner) -> bool, + fn coalesce(list: &mut AncestorList, + bail_opt: option, + forward_blk: fn(TaskGroupInner) -> bool, last_generation: uint) -> bool { // Need to swap the list out to use it, to appease borrowck. - let tmp_list = util::replace(list, ancestor_list(none)); + let tmp_list = util::replace(list, AncestorList(none)); let (coalesce_this, early_break) = iterate(tmp_list, bail_opt, forward_blk, last_generation); // What should our next ancestor end up being? @@ -816,10 +821,10 @@ fn each_ancestor(list: &mut ancestor_list, // bool: // True if the supplied block did 'break', here or in any recursive // calls. If so, must call the unwinder on all previous nodes. - fn iterate(ancestors: ancestor_list, - bail_opt: option, - forward_blk: fn(taskgroup_inner) -> bool, - last_generation: uint) -> (option, bool) { + fn iterate(ancestors: AncestorList, + bail_opt: option, + forward_blk: fn(TaskGroupInner) -> bool, + last_generation: uint) -> (option, bool) { // At each step of iteration, three booleans are at play which govern // how the iteration should behave. // 'nobe_is_dead' - Should the list should be coalesced at this point? @@ -885,7 +890,7 @@ fn each_ancestor(list: &mut ancestor_list, if nobe_is_dead { // Swap the list out here; the caller replaces us with it. let rest = util::replace(&mut nobe.ancestors, - ancestor_list(none)); + AncestorList(none)); (some(rest), need_unwind) } else { (none, need_unwind) @@ -894,8 +899,8 @@ fn each_ancestor(list: &mut ancestor_list, }; // Wrapper around exclusive::with that appeases borrowck. - fn with_parent_tg(parent_group: &mut option, - blk: fn(taskgroup_inner) -> U) -> U { + fn with_parent_tg(parent_group: &mut option, + blk: fn(TaskGroupInner) -> U) -> U { // If this trips, more likely the problem is 'blk' failed inside. let tmp_arc = option::swap_unwrap(parent_group); let result = do access_group(tmp_arc) |tg_opt| { blk(tg_opt) }; @@ -906,16 +911,16 @@ fn each_ancestor(list: &mut ancestor_list, } // One of these per task. -class tcb { +class Tcb { let me: *rust_task; // List of tasks with whose fates this one's is intertwined. - let tasks: taskgroup_arc; // 'none' means the group has failed. + let tasks: TaskGroupArc; // 'none' means the group has failed. // Lists of tasks who will kill us if they fail, but whom we won't kill. - let mut ancestors: ancestor_list; + let mut ancestors: AncestorList; let is_main: bool; - let notifier: option; - new(me: *rust_task, -tasks: taskgroup_arc, -ancestors: ancestor_list, - is_main: bool, -notifier: option) { + let notifier: option; + new(me: *rust_task, -tasks: TaskGroupArc, -ancestors: AncestorList, + is_main: bool, -notifier: option) { self.me = me; self.tasks = tasks; self.ancestors = ancestors; @@ -947,20 +952,20 @@ class tcb { } } -class auto_notify { - let notify_chan: comm::chan; +class AutoNotify { + let notify_chan: comm::Chan; let mut failed: bool; - new(chan: comm::chan) { + new(chan: comm::Chan) { self.notify_chan = chan; self.failed = true; // Un-set above when taskgroup successfully made. } drop { - let result = if self.failed { failure } else { success }; - comm::send(self.notify_chan, exit(get_task(), result)); + let result = if self.failed { Failure } else { Success }; + comm::send(self.notify_chan, Exit(get_task(), result)); } } -fn enlist_in_taskgroup(state: taskgroup_inner, me: *rust_task, +fn enlist_in_taskgroup(state: TaskGroupInner, me: *rust_task, is_member: bool) -> bool { let newstate = util::replace(state, none); // If 'none', the group was failing. Can't enlist. @@ -976,7 +981,7 @@ fn enlist_in_taskgroup(state: taskgroup_inner, me: *rust_task, } // NB: Runs in destructor/post-exit context. Can't 'fail'. -fn leave_taskgroup(state: taskgroup_inner, me: *rust_task, is_member: bool) { +fn leave_taskgroup(state: TaskGroupInner, me: *rust_task, is_member: bool) { let newstate = util::replace(state, none); // If 'none', already failing and we've already gotten a kill signal. if newstate.is_some() { @@ -988,7 +993,7 @@ fn leave_taskgroup(state: taskgroup_inner, me: *rust_task, is_member: bool) { } // NB: Runs in destructor/post-exit context. Can't 'fail'. -fn kill_taskgroup(state: taskgroup_inner, me: *rust_task, is_main: bool) { +fn kill_taskgroup(state: TaskGroupInner, me: *rust_task, is_main: bool) { // NB: We could do the killing iteration outside of the group arc, by // having "let mut newstate" here, swapping inside, and iterating after. // But that would let other exiting tasks fall-through and exit while we @@ -1031,7 +1036,7 @@ macro_rules! taskgroup_key { } fn gen_child_taskgroup(linked: bool, supervised: bool) - -> (taskgroup_arc, ancestor_list, bool) { + -> (TaskGroupArc, AncestorList, bool) { let spawner = rustrt::rust_get_task(); /*######################################################################* * Step 1. Get spawner's taskgroup info. @@ -1047,7 +1052,7 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) mut descendants: new_taskset() })); // Main task/group has no ancestors, no notifier, etc. let group = - @tcb(spawner, tasks, ancestor_list(none), true, none); + @Tcb(spawner, tasks, AncestorList(none), true, none); unsafe { local_set(spawner, taskgroup_key!(), group); } group } @@ -1080,18 +1085,18 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) }; assert new_generation < uint::max_value; // Build a new node in the ancestor list. - ancestor_list(some(unsafe::exclusive( + AncestorList(some(unsafe::exclusive( { generation: new_generation, mut parent_group: some(spawner_group.tasks.clone()), mut ancestors: old_ancestors }))) } else { // Child has no ancestors. - ancestor_list(none) + AncestorList(none) }; (g,a, false) }; - fn share_ancestors(ancestors: &mut ancestor_list) -> ancestor_list { + fn share_ancestors(ancestors: &mut AncestorList) -> AncestorList { // Appease the borrow-checker. Really this wants to be written as: // match ancestors // some(ancestor_arc) { ancestor_list(some(ancestor_arc.clone())) } @@ -1101,14 +1106,14 @@ fn gen_child_taskgroup(linked: bool, supervised: bool) let ancestor_arc = option::unwrap(tmp); let result = ancestor_arc.clone(); **ancestors <- some(ancestor_arc); - ancestor_list(some(result)) + AncestorList(some(result)) } else { - ancestor_list(none) + AncestorList(none) } } } -fn spawn_raw(+opts: task_opts, +f: fn~()) { +fn spawn_raw(+opts: TaskOpts, +f: fn~()) { let (child_tg, ancestors, is_main) = gen_child_taskgroup(opts.linked, opts.supervised); @@ -1146,9 +1151,9 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { // (3a) If any of those fails, it leaves all groups, and does nothing. // (3b) Otherwise it builds a task control structure and puts it in TLS, // (4) ...and runs the provided body function. - fn make_child_wrapper(child: *rust_task, +child_arc: taskgroup_arc, - +ancestors: ancestor_list, is_main: bool, - notify_chan: option>, + fn make_child_wrapper(child: *rust_task, +child_arc: TaskGroupArc, + +ancestors: AncestorList, is_main: bool, + notify_chan: option>, +f: fn~()) -> fn~() { let child_data = ~mut some((child_arc, ancestors)); return fn~() { @@ -1158,10 +1163,10 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { // Even if the below code fails to kick the child off, we must // send something on the notify channel. - let notifier = notify_chan.map(|c| auto_notify(c)); + let notifier = notify_chan.map(|c| AutoNotify(c)); if enlist_many(child, child_arc, &mut ancestors) { - let group = @tcb(child, child_arc, ancestors, + let group = @Tcb(child, child_arc, ancestors, is_main, notifier); unsafe { local_set(child, taskgroup_key!(), group); } // Run the child's body. @@ -1173,8 +1178,8 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { // Set up membership in taskgroup and descendantship in all ancestor // groups. If any enlistment fails, some task was already failing, so // don't let the child task run, and undo every successful enlistment. - fn enlist_many(child: *rust_task, child_arc: taskgroup_arc, - ancestors: &mut ancestor_list) -> bool { + fn enlist_many(child: *rust_task, child_arc: TaskGroupArc, + ancestors: &mut AncestorList) -> bool { // Join this taskgroup. let mut result = do access_group(child_arc) |child_tg| { @@ -1203,29 +1208,29 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { } } - fn new_task_in_new_sched(opts: sched_opts) -> *rust_task { + fn new_task_in_new_sched(opts: SchedOpts) -> *rust_task { if opts.foreign_stack_size != none { fail ~"foreign_stack_size scheduler option unimplemented"; } let num_threads = match opts.mode { - single_threaded => 1u, - thread_per_core => { + SingleThreaded => 1u, + ThreadPerCore => { fail ~"thread_per_core scheduling mode unimplemented" } - thread_per_task => { + ThreadPerTask => { fail ~"thread_per_task scheduling mode unimplemented" } - manual_threads(threads) => { + ManualThreads(threads) => { if threads == 0u { fail ~"can not create a scheduler with no threads"; } threads } - platform_thread => 0u /* Won't be used */ + PlatformThread => 0u /* Won't be used */ }; - let sched_id = if opts.mode != platform_thread { + let sched_id = if opts.mode != PlatformThread { rustrt::rust_new_sched(num_threads) } else { rustrt::rust_osmain_sched_id() @@ -1262,26 +1267,26 @@ fn spawn_raw(+opts: task_opts, +f: fn~()) { * * These two cases aside, the interface is safe. */ -type local_data_key = &fn(+@T); +type LocalDataKey = &fn(+@T); -trait local_data { } -impl @T: local_data { } +trait LocalData { } +impl @T: LocalData { } // We use dvec because it's the best data structure in core. If TLS is used // heavily in future, this could be made more efficient with a proper map. -type task_local_element = (*libc::c_void, *libc::c_void, local_data); +type TaskLocalElement = (*libc::c_void, *libc::c_void, LocalData); // Has to be a pointer at outermost layer; the foreign call returns void *. -type task_local_map = @dvec::DVec>; +type TaskLocalMap = @dvec::DVec>; extern fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe { assert !map_ptr.is_null(); // Get and keep the single reference that was created at the beginning. - let _map: task_local_map = unsafe::reinterpret_cast(map_ptr); + let _map: TaskLocalMap = unsafe::reinterpret_cast(map_ptr); // All local_data will be destroyed along with the map. } // Gets the map from the runtime. Lazily initialises if not done so already. -unsafe fn get_task_local_map(task: *rust_task) -> task_local_map { +unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap { // Relies on the runtime initialising the pointer to null. // NOTE: The map's box lives in TLS invisibly referenced once. Each time @@ -1289,7 +1294,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> task_local_map { // drop when they finish. No "re-storing after modifying" is needed. let map_ptr = rustrt::rust_get_task_local_data(task); if map_ptr.is_null() { - let map: task_local_map = @dvec::dvec(); + let map: TaskLocalMap = @dvec::dvec(); // Use reinterpret_cast -- transmute would take map away from us also. rustrt::rust_set_task_local_data(task, unsafe::reinterpret_cast(map)); rustrt::rust_task_local_data_atexit(task, cleanup_task_local_map); @@ -1304,7 +1309,7 @@ unsafe fn get_task_local_map(task: *rust_task) -> task_local_map { } unsafe fn key_to_key_value( - key: local_data_key) -> *libc::c_void { + key: LocalDataKey) -> *libc::c_void { // Keys are closures, which are (fnptr,envptr) pairs. Use fnptr. // Use reintepret_cast -- transmute would leak (forget) the closure. @@ -1314,7 +1319,7 @@ unsafe fn key_to_key_value( // If returning some(..), returns with @T with the map's reference. Careful! unsafe fn local_data_lookup( - map: task_local_map, key: local_data_key) + map: TaskLocalMap, key: LocalDataKey) -> option<(uint, *libc::c_void)> { let key_value = key_to_key_value(key); @@ -1332,7 +1337,7 @@ unsafe fn local_data_lookup( } unsafe fn local_get_helper( - task: *rust_task, key: local_data_key, + task: *rust_task, key: LocalDataKey, do_pop: bool) -> option<@T> { let map = get_task_local_map(task); @@ -1354,20 +1359,20 @@ unsafe fn local_get_helper( unsafe fn local_pop( task: *rust_task, - key: local_data_key) -> option<@T> { + key: LocalDataKey) -> option<@T> { local_get_helper(task, key, true) } unsafe fn local_get( task: *rust_task, - key: local_data_key) -> option<@T> { + key: LocalDataKey) -> option<@T> { local_get_helper(task, key, false) } unsafe fn local_set( - task: *rust_task, key: local_data_key, +data: @T) { + task: *rust_task, key: LocalDataKey, +data: @T) { let map = get_task_local_map(task); // Store key+data as *voids. Data is invisibly referenced once; key isn't. @@ -1378,7 +1383,7 @@ unsafe fn local_set( // does not have a reference associated with it, so it may become invalid // when the box is destroyed. let data_ptr = unsafe::reinterpret_cast(data); - let data_box = data as local_data; + let data_box = data as LocalData; // Construct new entry to store in the map. let new_entry = some((keyval, data_ptr, data_box)); // Find a place to put it. @@ -1399,7 +1404,7 @@ unsafe fn local_set( } unsafe fn local_modify( - task: *rust_task, key: local_data_key, + task: *rust_task, key: LocalDataKey, modify_fn: fn(option<@T>) -> option<@T>) { // Could be more efficient by doing the lookup work, but this is easy. @@ -1415,7 +1420,7 @@ unsafe fn local_modify( * reference that was originally created to insert it. */ unsafe fn local_data_pop( - key: local_data_key) -> option<@T> { + key: LocalDataKey) -> option<@T> { local_pop(rustrt::rust_get_task(), key) } @@ -1424,7 +1429,7 @@ unsafe fn local_data_pop( * table until explicitly removed. */ unsafe fn local_data_get( - key: local_data_key) -> option<@T> { + key: LocalDataKey) -> option<@T> { local_get(rustrt::rust_get_task(), key) } @@ -1433,7 +1438,7 @@ unsafe fn local_data_get( * that value is overwritten (and its destructor is run). */ unsafe fn local_data_set( - key: local_data_key, +data: @T) { + key: LocalDataKey, +data: @T) { local_set(rustrt::rust_get_task(), key, data) } @@ -1442,7 +1447,7 @@ unsafe fn local_data_set( * data is removed (and its reference dropped). */ unsafe fn local_data_modify( - key: local_data_key, + key: LocalDataKey, modify_fn: fn(option<@T>) -> option<@T>) { local_modify(rustrt::rust_get_task(), key, modify_fn) @@ -1558,7 +1563,7 @@ fn test_spawn_linked_sup_fail_up() { // child fails; parent fails // We have to cheat with opts - the interface doesn't support them because // they don't make sense (redundant with task().supervised()). let b0 = task(); - let b1 = task_builder({ + let b1 = TaskBuilder({ opts: { linked: true, supervised: true with b0.opts }, can_not_copy: none, with *b0 @@ -1571,7 +1576,7 @@ fn test_spawn_linked_sup_fail_down() { // parent fails; child fails // We have to cheat with opts - the interface doesn't support them because // they don't make sense (redundant with task().supervised()). let b0 = task(); - let b1 = task_builder({ + let b1 = TaskBuilder({ opts: { linked: true, supervised: true with b0.opts }, can_not_copy: none, with *b0 @@ -1667,7 +1672,7 @@ fn test_spawn_raw_notify() { comm::send(task_ch, get_task()); } let task_ = comm::recv(task_po); - assert comm::recv(notify_po) == exit(task_, success); + assert comm::recv(notify_po) == Exit(task_, Success); let opts = { linked: false, @@ -1679,7 +1684,7 @@ fn test_spawn_raw_notify() { fail; } let task_ = comm::recv(task_po); - assert comm::recv(notify_po) == exit(task_, failure); + assert comm::recv(notify_po) == Exit(task_, Failure); } #[test] @@ -1712,13 +1717,13 @@ fn test_add_wrapper() { fn test_future_result() { let mut result = none; do task().future_result(|+r| { result = some(r); }).spawn { } - assert future::get(&option::unwrap(result)) == success; + assert future::get(&option::unwrap(result)) == Success; result = none; do task().future_result(|+r| { result = some(r); }).unlinked().spawn { fail; } - assert future::get(&option::unwrap(result)) == failure; + assert future::get(&option::unwrap(result)) == Failure; } #[test] #[should_fail] #[ignore(cfg(windows))] @@ -1779,7 +1784,7 @@ fn test_try_fail() { #[should_fail] #[ignore(cfg(windows))] fn test_spawn_sched_no_threads() { - do spawn_sched(manual_threads(0u)) { } + do spawn_sched(ManualThreads(0u)) { } } #[test] @@ -1787,10 +1792,10 @@ fn test_spawn_sched() { let po = comm::port(); let ch = comm::chan(po); - fn f(i: int, ch: comm::chan<()>) { + fn f(i: int, ch: comm::Chan<()>) { let parent_sched_id = rustrt::rust_get_sched_id(); - do spawn_sched(single_threaded) { + do spawn_sched(SingleThreaded) { let child_sched_id = rustrt::rust_get_sched_id(); assert parent_sched_id != child_sched_id; @@ -1811,7 +1816,7 @@ fn test_spawn_sched_childs_on_same_sched() { let po = comm::port(); let ch = comm::chan(po); - do spawn_sched(single_threaded) { + do spawn_sched(SingleThreaded) { let parent_sched_id = rustrt::rust_get_sched_id(); do spawn { let child_sched_id = rustrt::rust_get_sched_id(); @@ -1849,7 +1854,7 @@ fn test_spawn_sched_blocking() { let lock = testrt::rust_dbg_lock_create(); - do spawn_sched(single_threaded) { + do spawn_sched(SingleThreaded) { testrt::rust_dbg_lock_lock(lock); comm::send(start_ch, ()); @@ -1864,7 +1869,7 @@ fn test_spawn_sched_blocking() { // Wait until the other task has its lock comm::recv(start_po); - fn pingpong(po: comm::port, ch: comm::chan) { + fn pingpong(po: comm::Port, ch: comm::Chan) { let mut val = 20; while val > 0 { val = comm::recv(po); @@ -1918,7 +1923,7 @@ fn test_avoid_copying_the_body_spawn() { #[test] fn test_avoid_copying_the_body_spawn_listener() { do avoid_copying_the_body |f| { - spawn_listener(fn~(move f, _po: comm::port) { + spawn_listener(fn~(move f, _po: comm::Port) { f(); }); } @@ -1936,7 +1941,7 @@ fn test_avoid_copying_the_body_task_spawn() { #[test] fn test_avoid_copying_the_body_spawn_listener_1() { do avoid_copying_the_body |f| { - task().spawn_listener(fn~(move f, _po: comm::port) { + task().spawn_listener(fn~(move f, _po: comm::Port) { f(); }); } @@ -1964,7 +1969,7 @@ fn test_avoid_copying_the_body_unlinked() { fn test_platform_thread() { let po = comm::port(); let ch = comm::chan(po); - do task().sched_mode(platform_thread).spawn { + do task().sched_mode(PlatformThread).spawn { comm::send(ch, ()); } comm::recv(po); diff --git a/src/libstd/net_ip.rs b/src/libstd/net_ip.rs index 5e25a91d90137..b361e38ac29a9 100644 --- a/src/libstd/net_ip.rs +++ b/src/libstd/net_ip.rs @@ -245,7 +245,7 @@ mod v6 { } type get_addr_data = { - output_ch: comm::chan> + output_ch: comm::Chan> }; extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int, diff --git a/src/libstd/net_tcp.rs b/src/libstd/net_tcp.rs index b07c2fdfda72e..e07075dd293c1 100644 --- a/src/libstd/net_tcp.rs +++ b/src/libstd/net_tcp.rs @@ -292,7 +292,7 @@ fn write(sock: tcp_socket, raw_write_data: ~[u8]) * value as the `err` variant */ fn write_future(sock: tcp_socket, raw_write_data: ~[u8]) - -> future::future> unsafe { + -> future::Future> unsafe { let socket_data_ptr = ptr::addr_of(*(sock.socket_data)); do future_spawn { let data_copy = copy(raw_write_data); @@ -315,7 +315,7 @@ fn write_future(sock: tcp_socket, raw_write_data: ~[u8]) * on) from until `read_stop` is called, or a `tcp_err_data` record */ fn read_start(sock: tcp_socket) - -> result::result result::result>, tcp_err_data> unsafe { let socket_data = ptr::addr_of(*(sock.socket_data)); read_start_common_impl(socket_data) @@ -329,7 +329,7 @@ fn read_start(sock: tcp_socket) * * `sock` - a `net::tcp::tcp_socket` that you wish to stop reading on */ fn read_stop(sock: tcp_socket, - -read_port: comm::port>) -> + -read_port: comm::Port>) -> result::result<(), tcp_err_data> unsafe { log(debug, fmt!{"taking the read_port out of commission %?", read_port}); let socket_data = ptr::addr_of(*sock.socket_data); @@ -387,7 +387,7 @@ fn read(sock: tcp_socket, timeout_msecs: uint) * read attempt. Pass `0u` to wait indefinitely */ fn read_future(sock: tcp_socket, timeout_msecs: uint) - -> future::future> { + -> future::Future> { let socket_data = ptr::addr_of(*(sock.socket_data)); do future_spawn { read_common_impl(socket_data, timeout_msecs) @@ -563,9 +563,9 @@ fn accept(new_conn: tcp_new_connection) */ fn listen(-host_ip: ip::ip_addr, port: uint, backlog: uint, iotask: iotask, - on_establish_cb: fn~(comm::chan>), + on_establish_cb: fn~(comm::Chan>), +new_connect_cb: fn~(tcp_new_connection, - comm::chan>)) + comm::Chan>)) -> result::result<(), tcp_listen_err_data> unsafe { do listen_common(host_ip, port, backlog, iotask, on_establish_cb) // on_connect_cb @@ -580,7 +580,7 @@ fn listen(-host_ip: ip::ip_addr, port: uint, backlog: uint, fn listen_common(-host_ip: ip::ip_addr, port: uint, backlog: uint, iotask: iotask, - on_establish_cb: fn~(comm::chan>), + on_establish_cb: fn~(comm::Chan>), -on_connect_cb: fn~(*uv::ll::uv_tcp_t)) -> result::result<(), tcp_listen_err_data> unsafe { let stream_closed_po = comm::port::<()>(); @@ -724,12 +724,12 @@ fn socket_buf(-sock: tcp_socket) -> tcp_socket_buf { /// Convenience methods extending `net::tcp::tcp_socket` impl tcp_socket { - fn read_start() -> result::result result::result>, tcp_err_data> { read_start(self) } fn read_stop(-read_port: - comm::port>) -> + comm::Port>) -> result::result<(), tcp_err_data> { read_stop(self, read_port) } @@ -738,7 +738,7 @@ impl tcp_socket { read(self, timeout_msecs) } fn read_future(timeout_msecs: uint) -> - future::future> { + future::Future> { read_future(self, timeout_msecs) } fn write(raw_write_data: ~[u8]) @@ -746,7 +746,7 @@ impl tcp_socket { write(self, raw_write_data) } fn write_future(raw_write_data: ~[u8]) - -> future::future> { + -> future::Future> { write_future(self, raw_write_data) } } @@ -922,7 +922,7 @@ fn read_stop_common_impl(socket_data: *tcp_socket_data) -> // shared impl for read_start fn read_start_common_impl(socket_data: *tcp_socket_data) - -> result::result result::result>, tcp_err_data> unsafe { let stream_handle_ptr = (*socket_data).stream_handle_ptr; let start_po = comm::port::>(); @@ -1002,8 +1002,8 @@ enum tcp_new_connection { type tcp_listen_fc_data = { server_stream_ptr: *uv::ll::uv_tcp_t, - stream_closed_ch: comm::chan<()>, - kill_ch: comm::chan>, + stream_closed_ch: comm::Chan<()>, + kill_ch: comm::Chan>, on_connect_cb: fn~(*uv::ll::uv_tcp_t), iotask: iotask, mut active: bool @@ -1050,7 +1050,7 @@ enum tcp_write_result { } enum tcp_read_start_result { - tcp_read_start_success(comm::port), + tcp_read_start_success(comm::Port), tcp_read_start_error(tcp_err_data) } @@ -1116,7 +1116,7 @@ extern fn on_alloc_cb(handle: *libc::c_void, } type tcp_socket_close_data = { - closed_ch: comm::chan<()> + closed_ch: comm::Chan<()> }; extern fn tcp_socket_dtor_close_cb(handle: *uv::ll::uv_tcp_t) unsafe { @@ -1145,12 +1145,12 @@ extern fn tcp_write_complete_cb(write_req: *uv::ll::uv_write_t, } type write_req_data = { - result_ch: comm::chan + result_ch: comm::Chan }; type connect_req_data = { - result_ch: comm::chan, - closed_signal_ch: comm::chan<()> + result_ch: comm::Chan, + closed_signal_ch: comm::Chan<()> }; extern fn stream_error_close_cb(handle: *uv::ll::uv_tcp_t) unsafe { @@ -1198,8 +1198,8 @@ enum conn_attempt { } type tcp_socket_data = { - reader_po: comm::port>, - reader_ch: comm::chan>, + reader_po: comm::Port>, + reader_ch: comm::Chan>, stream_handle_ptr: *uv::ll::uv_tcp_t, connect_req: uv::ll::uv_connect_t, write_req: uv::ll::uv_write_t, @@ -1285,7 +1285,7 @@ mod test { let cont_po = comm::port::<()>(); let cont_ch = comm::chan(cont_po); // server - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { let actual_req = do comm::listen |server_ch| { run_tcp_test_server( server_ip, @@ -1351,7 +1351,7 @@ mod test { let cont_po = comm::port::<()>(); let cont_ch = comm::chan(cont_po); // server - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { let actual_req = do comm::listen |server_ch| { run_tcp_test_server( server_ip, @@ -1421,7 +1421,7 @@ mod test { let cont_po = comm::port::<()>(); let cont_ch = comm::chan(cont_po); // server - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { let actual_req = do comm::listen |server_ch| { run_tcp_test_server( server_ip, @@ -1475,8 +1475,8 @@ mod test { } fn run_tcp_test_server(server_ip: ~str, server_port: uint, resp: ~str, - server_ch: comm::chan<~str>, - cont_ch: comm::chan<()>, + server_ch: comm::Chan<~str>, + cont_ch: comm::Chan<()>, iotask: iotask) -> ~str { let server_ip_addr = ip::v4::parse_addr(server_ip); let listen_result = listen(server_ip_addr, server_port, 128u, iotask, @@ -1491,7 +1491,7 @@ mod test { |new_conn, kill_ch| { log(debug, ~"SERVER: new connection!"); do comm::listen |cont_ch| { - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { log(debug, ~"SERVER: starting worker for new req"); let accept_result = accept(new_conn); @@ -1582,7 +1582,7 @@ mod test { } fn run_tcp_test_client(server_ip: ~str, server_port: uint, resp: ~str, - client_ch: comm::chan<~str>, + client_ch: comm::Chan<~str>, iotask: iotask) -> result::result<~str, tcp_connect_err_data> { let server_ip_addr = ip::v4::parse_addr(server_ip); diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs index bf44e3f25ea65..1438e4ab180e3 100644 --- a/src/libstd/sync.rs +++ b/src/libstd/sync.rs @@ -720,7 +720,7 @@ mod tests { fn test_sem_runtime_friendly_blocking() { // Force the runtime to schedule two threads on the same sched_loop. // When one blocks, it should schedule the other one. - do task::spawn_sched(task::manual_threads(1)) { + do task::spawn_sched(task::ManualThreads(1)) { let s = ~semaphore(1); let s2 = ~s.clone(); let (c,p) = pipes::stream(); diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 6b78fa9b0320f..b61ad7e5a61e1 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -9,7 +9,7 @@ import either::Either; import result::{ok, err}; import io::WriterUtil; import libc::size_t; -import task::task_builder; +import task::TaskBuilder; export test_name; export test_fn; @@ -379,7 +379,7 @@ fn filter_tests(opts: test_opts, type test_future = {test: test_desc, wait: fn@() -> test_result}; -fn run_test(+test: test_desc, monitor_ch: comm::chan) { +fn run_test(+test: test_desc, monitor_ch: comm::Chan) { if test.ignore { comm::send(monitor_ch, (copy test, tr_ignored)); return; @@ -392,7 +392,7 @@ fn run_test(+test: test_desc, monitor_ch: comm::chan) { result_future = some(r); }).spawn(testfn); let task_result = future::get(&option::unwrap(result_future)); - let test_result = calc_result(test, task_result == task::success); + let test_result = calc_result(test, task_result == task::Success); comm::send(monitor_ch, (copy test, test_result)); }; } diff --git a/src/libstd/timer.rs b/src/libstd/timer.rs index 336b53daa9667..468a846163b25 100644 --- a/src/libstd/timer.rs +++ b/src/libstd/timer.rs @@ -22,7 +22,7 @@ export delayed_send, sleep, recv_timeout; * * val - a value of type T to send over the provided `ch` */ fn delayed_send(iotask: iotask, - msecs: uint, ch: comm::chan, val: T) { + msecs: uint, ch: comm::Chan, val: T) { unsafe { let timer_done_po = comm::port::<()>(); let timer_done_ch = comm::chan(timer_done_po); @@ -99,7 +99,7 @@ fn sleep(iotask: iotask, msecs: uint) { */ fn recv_timeout(iotask: iotask, msecs: uint, - wait_po: comm::port) -> option { + wait_po: comm::Port) -> option { let timeout_po = comm::port::<()>(); let timeout_ch = comm::chan(timeout_po); delayed_send(iotask, msecs, timeout_ch, ()); @@ -120,7 +120,7 @@ extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t, 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 *comm::Chan<()>); let stop_result = uv::ll::timer_stop(handle); if (stop_result == 0i32) { comm::send(timer_done_ch, ()); @@ -136,7 +136,7 @@ extern fn delayed_send_cb(handle: *uv::ll::uv_timer_t, 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<()>); + *(uv::ll::get_data_for_uv_handle(handle) as *comm::Chan<()>); comm::send(timer_done_ch, ()); } diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 96b7e46dabf4b..b28b0033a017e 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -7,8 +7,8 @@ import iotask = uv_iotask; import get_gl = get; import iotask::{iotask, spawn_iotask}; import priv::{chan_from_global_ptr, weaken_task}; -import comm::{port, chan, select2, listen}; -import task::task_builder; +import comm::{Port, Chan, port, chan, select2, listen}; +import task::TaskBuilder; import either::{Left, Right}; extern mod rustrt { @@ -40,13 +40,13 @@ fn get_monitor_task_gl() -> iotask unsafe { monitor_loop_chan_ptr}; debug!{"before priv::chan_from_global_ptr"}; - type monchan = chan; + type monchan = Chan; let monitor_ch = do chan_from_global_ptr::(monitor_loop_chan_ptr, || { task::task().sched_mode - (task::single_threaded) + (task::SingleThreaded) .unlinked() }) |msg_po| { debug!{"global monitor task starting"}; @@ -108,7 +108,7 @@ fn spawn_loop() -> iotask unsafe { 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; + timer_ptr as *libc::c_void) as *comm::Chan; let exit_ch = *exit_ch_ptr; comm::send(exit_ch, true); log(debug, fmt!{"EXIT_CH_PTR simple_timer_close_cb exit_ch_ptr: %?", @@ -164,7 +164,7 @@ mod test { let hl_loop = get_gl(); let exit_po = comm::port::<()>(); let exit_ch = comm::chan(exit_po); - task::spawn_sched(task::manual_threads(1u), || { + task::spawn_sched(task::ManualThreads(1u), || { impl_uv_hl_simple_timer(hl_loop); comm::send(exit_ch, ()); }); @@ -182,7 +182,7 @@ mod test { let exit_ch = comm::chan(exit_po); let cycles = 5000u; for iter::repeat(cycles) { - task::spawn_sched(task::manual_threads(1u), || { + task::spawn_sched(task::ManualThreads(1u), || { impl_uv_hl_simple_timer(hl_loop); comm::send(exit_ch, ()); }); diff --git a/src/libstd/uv_iotask.rs b/src/libstd/uv_iotask.rs index 324a90553c7eb..dd7063e4c9ba7 100644 --- a/src/libstd/uv_iotask.rs +++ b/src/libstd/uv_iotask.rs @@ -12,23 +12,23 @@ export exit; import libc::c_void; import ptr::addr_of; -import comm::{port, chan, listen}; -import task::task_builder; +import comm::{Port, port, Chan, chan, listen}; +import task::TaskBuilder; import ll = uv_ll; /// Used to abstract-away direct interaction with a libuv loop. enum iotask { iotask_({ async_handle: *ll::uv_async_t, - op_chan: chan + op_chan: Chan }) } -fn spawn_iotask(-task: task::task_builder) -> iotask { +fn spawn_iotask(-task: task::TaskBuilder) -> iotask { do listen |iotask_ch| { - do task.sched_mode(task::single_threaded).spawn { + do task.sched_mode(task::SingleThreaded).spawn { debug!{"entering libuv task"}; run_loop(iotask_ch); debug!{"libuv task exiting"}; @@ -86,7 +86,7 @@ enum iotask_msg { } /// Run the loop and begin handling messages -fn run_loop(iotask_ch: chan) unsafe { +fn run_loop(iotask_ch: Chan) unsafe { let loop_ptr = ll::loop_new(); @@ -123,7 +123,7 @@ fn run_loop(iotask_ch: chan) unsafe { // data that lives for the lifetime of the high-evel oo type iotask_loop_data = { async_handle: *ll::uv_async_t, - msg_po: port + msg_po: Port }; fn send_msg(iotask: iotask, @@ -180,7 +180,7 @@ mod test { } type ah_data = { iotask: iotask, - exit_ch: comm::chan<()> + exit_ch: comm::Chan<()> }; fn impl_uv_iotask_async(iotask: iotask) unsafe { let async_handle = ll::async_t(); @@ -202,10 +202,10 @@ mod test { // this fn documents the bear minimum neccesary to roll your own // high_level_loop - unsafe fn spawn_test_loop(exit_ch: comm::chan<()>) -> iotask { + unsafe fn spawn_test_loop(exit_ch: comm::Chan<()>) -> iotask { let iotask_port = comm::port::(); let iotask_ch = comm::chan(iotask_port); - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { run_loop(iotask_ch); exit_ch.send(()); }; @@ -237,7 +237,7 @@ mod test { let work_exit_po = comm::port::<()>(); let work_exit_ch = comm::chan(work_exit_po); for iter::repeat(7u) { - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { impl_uv_iotask_async(iotask); comm::send(work_exit_ch, ()); }; diff --git a/src/libstd/uv_ll.rs b/src/libstd/uv_ll.rs index 26b95a9a37b93..c4c9d7c460764 100644 --- a/src/libstd/uv_ll.rs +++ b/src/libstd/uv_ll.rs @@ -1008,7 +1008,7 @@ mod test { type request_wrapper = { write_req: *uv_write_t, req_buf: *~[uv_buf_t], - read_chan: *comm::chan<~str> + read_chan: *comm::Chan<~str> }; extern fn after_close_cb(handle: *libc::c_void) { @@ -1106,7 +1106,7 @@ mod test { } fn impl_uv_tcp_request(ip: ~str, port: int, req_str: ~str, - client_chan: *comm::chan<~str>) unsafe { + client_chan: *comm::Chan<~str>) unsafe { let test_loop = loop_new(); let tcp_handle = tcp_t(); let tcp_handle_ptr = ptr::addr_of(tcp_handle); @@ -1323,12 +1323,12 @@ mod test { server: *uv_tcp_t, server_kill_msg: ~str, server_resp_buf: *~[uv_buf_t], - server_chan: *comm::chan<~str>, + server_chan: *comm::Chan<~str>, server_write_req: *uv_write_t }; type async_handle_data = { - continue_chan: *comm::chan + continue_chan: *comm::Chan }; extern fn async_close_cb(handle: *libc::c_void) { @@ -1354,8 +1354,8 @@ mod test { server_port: int, kill_server_msg: ~str, server_resp_msg: ~str, - server_chan: *comm::chan<~str>, - continue_chan: *comm::chan) unsafe { + server_chan: *comm::Chan<~str>, + continue_chan: *comm::Chan) unsafe { let test_loop = loop_new(); let tcp_server = tcp_t(); let tcp_server_ptr = ptr::addr_of(tcp_server); @@ -1469,7 +1469,7 @@ mod test { let continue_chan = comm::chan::(continue_port); let continue_chan_ptr = ptr::addr_of(continue_chan); - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { impl_uv_tcp_server(bind_ip, port, kill_server_msg, server_resp_msg, @@ -1482,7 +1482,7 @@ mod test { comm::recv(continue_port); log(debug, ~"received on continue port, set up tcp client"); - do task::spawn_sched(task::manual_threads(1u)) { + do task::spawn_sched(task::ManualThreads(1u)) { impl_uv_tcp_request(request_ip, port, kill_server_msg, ptr::addr_of(client_chan)); diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs index d737e41f81656..134af84866e5b 100644 --- a/src/rustc/driver/rustc.rs +++ b/src/rustc/driver/rustc.rs @@ -231,8 +231,8 @@ fn monitor(+f: fn~(diagnostic::emitter)) { }; class finally { - let ch: comm::chan; - new(ch: comm::chan) { self.ch = ch; } + let ch: comm::Chan; + new(ch: comm::Chan) { self.ch = ch; } drop { comm::send(self.ch, done); } } diff --git a/src/rustdoc/astsrv.rs b/src/rustdoc/astsrv.rs index 52746f66425c8..3dd029f2307de 100644 --- a/src/rustdoc/astsrv.rs +++ b/src/rustdoc/astsrv.rs @@ -43,7 +43,7 @@ enum msg { } enum srv = { - ch: comm::chan + ch: comm::Chan }; fn from_str(source: ~str, owner: srv_owner) -> T { @@ -67,7 +67,7 @@ fn run(owner: srv_owner, source: ~str, +parse: parser) -> T { return res; } -fn act(po: comm::port, source: ~str, parse: parser) { +fn act(po: comm::Port, source: ~str, parse: parser) { let sess = build_session(); let ctxt = build_ctxt( diff --git a/src/rustdoc/markdown_writer.rs b/src/rustdoc/markdown_writer.rs index 8265bbe17d884..20435a1cef46d 100644 --- a/src/rustdoc/markdown_writer.rs +++ b/src/rustdoc/markdown_writer.rs @@ -110,14 +110,14 @@ fn pandoc_writer( let stdout_po = comm::port(); let stdout_ch = comm::chan(stdout_po); - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { comm::send(stdout_ch, readclose(pipe_out.in)); } let stdout = comm::recv(stdout_po); let stderr_po = comm::port(); let stderr_ch = comm::chan(stderr_po); - do task::spawn_sched(task::single_threaded) { + do task::spawn_sched(task::SingleThreaded) { comm::send(stderr_ch, readclose(pipe_err.in)); } let stderr = comm::recv(stderr_po); @@ -146,7 +146,7 @@ fn readclose(fd: libc::c_int) -> ~str { } fn generic_writer(+process: fn~(markdown: ~str)) -> writer { - let ch = do task::spawn_listener |po: comm::port| { + let ch = do task::spawn_listener |po: comm::Port| { let mut markdown = ~""; let mut keep_going = true; while keep_going { @@ -265,7 +265,7 @@ fn write_file(path: ~str, s: ~str) { } fn future_writer_factory( -) -> (writer_factory, comm::port<(doc::page, ~str)>) { +) -> (writer_factory, comm::Port<(doc::page, ~str)>) { let markdown_po = comm::port(); let markdown_ch = comm::chan(markdown_po); let writer_factory = fn~(page: doc::page) -> writer { @@ -283,7 +283,7 @@ fn future_writer_factory( (writer_factory, markdown_po) } -fn future_writer() -> (writer, future::future<~str>) { +fn future_writer() -> (writer, future::Future<~str>) { let port = comm::port(); let chan = comm::chan(port); let writer = fn~(+instr: writeinstr) { diff --git a/src/rustdoc/page_pass.rs b/src/rustdoc/page_pass.rs index 592f8e0019020..24d9bbc0c7b42 100644 --- a/src/rustdoc/page_pass.rs +++ b/src/rustdoc/page_pass.rs @@ -38,8 +38,8 @@ fn run( comm::recv(result_port) } -type page_port = comm::port>; -type page_chan = comm::chan>; +type page_port = comm::Port>; +type page_chan = comm::Chan>; fn make_doc_from_pages(page_port: page_port) -> doc::doc { let mut pages = ~[]; diff --git a/src/test/auxiliary/cci_capture_clause.rs b/src/test/auxiliary/cci_capture_clause.rs index d14ed0e99f5e9..b4dda9cf5e211 100644 --- a/src/test/auxiliary/cci_capture_clause.rs +++ b/src/test/auxiliary/cci_capture_clause.rs @@ -2,7 +2,7 @@ export foo; import comm::*; -fn foo(x: T) -> port { +fn foo(x: T) -> Port { let p = port(); let c = chan(p); do task::spawn() |copy c, copy x| { diff --git a/src/test/bench/msgsend-ring.rs b/src/test/bench/msgsend-ring.rs index e3c51ec8d4372..418ea3e538f24 100644 --- a/src/test/bench/msgsend-ring.rs +++ b/src/test/bench/msgsend-ring.rs @@ -12,8 +12,8 @@ import std::time; fn thread_ring(i: uint, count: uint, - num_chan: comm::chan, - num_port: comm::port) { + num_chan: comm::Chan, + num_port: comm::Port) { // Send/Receive lots of messages. for uint::range(0u, count) |j| { num_chan.send(i * j); diff --git a/src/test/bench/msgsend.rs b/src/test/bench/msgsend.rs index abcf9f4ed5487..507515678220b 100644 --- a/src/test/bench/msgsend.rs +++ b/src/test/bench/msgsend.rs @@ -14,7 +14,7 @@ enum request { stop } -fn server(requests: comm::port, responses: comm::chan) { +fn server(requests: comm::Port, responses: comm::Chan) { let mut count = 0u; let mut done = false; while !done { diff --git a/src/test/bench/shootout-chameneos-redux.rs b/src/test/bench/shootout-chameneos-redux.rs index 17f2129ed80c0..05fdf0fb70954 100644 --- a/src/test/bench/shootout-chameneos-redux.rs +++ b/src/test/bench/shootout-chameneos-redux.rs @@ -85,9 +85,9 @@ fn transform(aa: color, bb: color) -> color { fn creature( name: uint, color: color, - from_rendezvous: comm::port>, - to_rendezvous: comm::chan, - to_rendezvous_log: comm::chan<~str> + from_rendezvous: comm::Port>, + to_rendezvous: comm::Chan, + to_rendezvous_log: comm::Chan<~str> ) { let mut color = color; let mut creatures_met = 0; @@ -122,17 +122,17 @@ fn creature( fn rendezvous(nn: uint, set: ~[color]) { // these ports will allow us to hear from the creatures - let from_creatures: comm::port = comm::port(); - let from_creatures_log: comm::port<~str> = comm::port(); + let from_creatures: comm::Port = comm::port(); + let from_creatures_log: comm::Port<~str> = comm::port(); // these channels will be passed to the creatures so they can talk to us let to_rendezvous = comm::chan(from_creatures); let to_rendezvous_log = comm::chan(from_creatures_log); // these channels will allow us to talk to each creature by 'name'/index - let to_creature: ~[comm::chan>] = + let to_creature: ~[comm::Chan>] = vec::mapi(set, - fn@(ii: uint, col: color) -> comm::chan> { + fn@(ii: uint, col: color) -> comm::Chan> { // create each creature as a listener with a port, and // give us a channel to talk to each return do task::spawn_listener |from_rendezvous| { diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index e5bd37c196862..467df1148df27 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -86,8 +86,8 @@ fn windows_with_carry(bb: &[u8], nn: uint, return vec::slice(bb, len - (nn - 1u), len); } -fn make_sequence_processor(sz: uint, from_parent: comm::port<~[u8]>, - to_parent: comm::chan<~str>) { +fn make_sequence_processor(sz: uint, from_parent: comm::Port<~[u8]>, + to_parent: comm::Chan<~str>) { let freqs: hashmap<~[u8], uint> = map::bytes_hash(); let mut carry: ~[u8] = ~[]; @@ -141,7 +141,7 @@ fn main(args: ~[~str]) { let sizes = ~[1u,2u,3u,4u,6u,12u,18u]; let from_child = vec::map (sizes, |_sz| comm::port() ); let to_parent = vec::mapi(sizes, |ii, _sz| comm::chan(from_child[ii]) ); - let to_child = vec::mapi(sizes, fn@(ii: uint, sz: uint) -> comm::chan<~[u8]> { + let to_child = vec::mapi(sizes, fn@(ii: uint, sz: uint) -> comm::Chan<~[u8]> { return do task::spawn_listener |from_parent| { make_sequence_processor(sz, from_parent, to_parent[ii]); }; diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index fcbd2e6fed015..252832f0cb758 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -75,7 +75,7 @@ fn fillbyte(x: cmplx, incr: f64) -> u8 { rv } -fn chanmb(i: uint, size: uint, ch: comm::chan) -> () +fn chanmb(i: uint, size: uint, ch: comm::Chan) -> () { let mut crv = ~[]; let incr = 2f64/(size as f64); @@ -98,9 +98,9 @@ impl devnull: io::Writer { fn get_type() -> io::WriterType { io::File } } -fn writer(path: ~str, writech: comm::chan>, size: uint) +fn writer(path: ~str, writech: comm::Chan>, size: uint) { - let p: comm::port = comm::port(); + let p: comm::Port = comm::port(); let ch = comm::chan(p); comm::send(writech, ch); let cout: io::Writer = match path { diff --git a/src/test/bench/shootout-threadring.rs b/src/test/bench/shootout-threadring.rs index 26bc2b739fab8..f3b1850c88c39 100644 --- a/src/test/bench/shootout-threadring.rs +++ b/src/test/bench/shootout-threadring.rs @@ -19,7 +19,7 @@ fn start(+token: int) { roundtrip(1, p, ch); } -fn roundtrip(id: int, p: comm::port, ch: comm::chan) { +fn roundtrip(id: int, p: comm::Port, ch: comm::Chan) { while (true) { match comm::recv(p) { 1 => { diff --git a/src/test/bench/task-perf-linked-failure.rs b/src/test/bench/task-perf-linked-failure.rs index 55833ce0fda3e..0b50195457e3c 100644 --- a/src/test/bench/task-perf-linked-failure.rs +++ b/src/test/bench/task-perf-linked-failure.rs @@ -34,7 +34,7 @@ fn spawn_supervised_blocking(myname: &str, +f: fn~()) { task::task().future_result(|+r| res = some(r)).supervised().spawn(f); #error["%s group waiting", myname]; let x = future::get(&option::unwrap(res)); - assert x == task::success; + assert x == task::Success; } fn main(args: ~[~str]) { diff --git a/src/test/bench/task-perf-one-million.rs b/src/test/bench/task-perf-one-million.rs index 7b434a5f255c8..2b854f83b6710 100644 --- a/src/test/bench/task-perf-one-million.rs +++ b/src/test/bench/task-perf-one-million.rs @@ -1,12 +1,12 @@ // Test for concurrent tasks enum msg { - ready(comm::chan), + ready(comm::Chan), start, done(int), } -fn calc(children: uint, parent_ch: comm::chan) { +fn calc(children: uint, parent_ch: comm::Chan) { let port = comm::port(); let chan = comm::chan(port); let mut child_chs = ~[]; diff --git a/src/test/bench/task-perf-word-count-generic.rs b/src/test/bench/task-perf-word-count-generic.rs index f48b05d0f1715..7e8084adb7de9 100644 --- a/src/test/bench/task-perf-word-count-generic.rs +++ b/src/test/bench/task-perf-word-count-generic.rs @@ -27,7 +27,9 @@ import u64; import task; import comm; +import comm::Chan; import comm::chan; +import comm::Port; import comm::port; import comm::recv; import comm::send; @@ -58,7 +60,7 @@ impl ~str: hash_key { } // These used to be in task, but they disappeard. -type joinable_task = port<()>; +type joinable_task = Port<()>; fn spawn_joinable(+f: fn~()) -> joinable_task { let p = port(); let c = chan(p); @@ -135,7 +137,7 @@ mod map_reduce { type reducer = fn~(K, getter); enum ctrl_proto { - find_reducer(K, chan>>), + find_reducer(K, Chan>>), mapper_done } @@ -147,7 +149,7 @@ mod map_reduce { } reducer_response: recv { - reducer(chan>) -> open + reducer(Chan>) -> open } } @@ -199,7 +201,7 @@ mod map_reduce { send(c.get(), emit_val(val)); } - fn finish(_k: K, v: chan>) + fn finish(_k: K, v: Chan>) { send(v, release); } @@ -210,7 +212,7 @@ mod map_reduce { fn reduce_task( reduce: reducer, key: K, - out: chan>>) + out: Chan>>) { let p = port(); @@ -219,7 +221,7 @@ mod map_reduce { let mut ref_count = 0; let mut is_done = false; - fn get(p: port>, + fn get(p: Port>, &ref_count: int, &is_done: bool) -> option { while !is_done || ref_count > 0 { diff --git a/src/test/compile-fail/fully-qualified-type-name4.rs b/src/test/compile-fail/fully-qualified-type-name4.rs index 00eb743422472..5ef4cc9fe73cb 100644 --- a/src/test/compile-fail/fully-qualified-type-name4.rs +++ b/src/test/compile-fail/fully-qualified-type-name4.rs @@ -1,10 +1,10 @@ // Test that we use fully-qualified type names in error messages. -import core::task::task; +import core::task::Task; -fn bar(x: uint) -> task { +fn bar(x: uint) -> Task { return x; - //~^ ERROR mismatched types: expected `core::task::task` + //~^ ERROR mismatched types: expected `core::task::Task` } fn main() { diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index b6304693149f5..a62278cefe148 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -1,7 +1,7 @@ fn main() { class foo { - let _x: comm::port<()>; - new(x: comm::port<()>) { self._x = x; } + let _x: comm::Port<()>; + new(x: comm::Port<()>) { self._x = x; } drop {} } diff --git a/src/test/run-fail/port-type.rs b/src/test/run-fail/port-type.rs index e33130df83ce4..835fc7acba466 100644 --- a/src/test/run-fail/port-type.rs +++ b/src/test/run-fail/port-type.rs @@ -1,11 +1,12 @@ // error-pattern:meep use std; +import comm::Chan; import comm::chan; import comm::port; import comm::send; import comm::recv; -fn echo(c: chan, oc: chan>) { +fn echo(c: Chan, oc: Chan>) { // Tests that the type argument in port gets // visited let p = port::(); diff --git a/src/test/run-pass/basic-1.rs b/src/test/run-pass/basic-1.rs index 31d04b88d4407..862020b65548c 100644 --- a/src/test/run-pass/basic-1.rs +++ b/src/test/run-pass/basic-1.rs @@ -1,13 +1,14 @@ // -*- rust -*- use std; +import comm::Chan; import comm::chan; import comm::port; import comm::send; import comm::recv; import task; -fn a(c: chan) { send(c, 10); } +fn a(c: Chan) { send(c, 10); } fn main() { let p = port(); @@ -20,7 +21,7 @@ fn main() { // debug!{"Finished."}; } -fn b(c: chan) { +fn b(c: Chan) { // debug!{"task b0"}; // debug!{"task b1"}; // debug!{"task b2"}; diff --git a/src/test/run-pass/basic-2.rs b/src/test/run-pass/basic-2.rs index ba81fb1ff9b70..ae884c9c6d5a6 100644 --- a/src/test/run-pass/basic-2.rs +++ b/src/test/run-pass/basic-2.rs @@ -4,11 +4,12 @@ use std; import comm; import comm::port; import comm::send; +import comm::Chan; import comm::chan; import comm::recv; import task; -fn a(c: chan) { debug!{"task a0"}; debug!{"task a1"}; send(c, 10); } +fn a(c: Chan) { debug!{"task a0"}; debug!{"task a1"}; send(c, 10); } fn main() { let p = port(); @@ -21,7 +22,7 @@ fn main() { debug!{"Finished."}; } -fn b(c: chan) { +fn b(c: Chan) { debug!{"task b0"}; debug!{"task b1"}; debug!{"task b2"}; diff --git a/src/test/run-pass/basic.rs b/src/test/run-pass/basic.rs index 311b1f2a1f01d..f3ebfa389045e 100644 --- a/src/test/run-pass/basic.rs +++ b/src/test/run-pass/basic.rs @@ -3,11 +3,12 @@ use std; import comm; import comm::send; +import comm::Chan; import comm::chan; import comm::recv; import task; -fn a(c: chan) { +fn a(c: Chan) { if true { debug!{"task a"}; debug!{"task a"}; @@ -42,7 +43,7 @@ fn main() { debug!{"children finished, root finishing"}; } -fn b(c: chan) { +fn b(c: Chan) { if true { debug!{"task b"}; debug!{"task b"}; diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 19bfaac0f0c03..d8909290ae49c 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -68,7 +68,7 @@ fn test_port() { } fn test_chan() { - let p: comm::port = comm::port(); + let p: comm::Port = comm::port(); let ch1 = comm::chan(p); let ch2 = comm::chan(p); diff --git a/src/test/run-pass/chan-leak.rs b/src/test/run-pass/chan-leak.rs index ca3f93a4df6c1..8902bcaf537d2 100644 --- a/src/test/run-pass/chan-leak.rs +++ b/src/test/run-pass/chan-leak.rs @@ -2,17 +2,18 @@ use std; import task; +import comm::Chan; import comm::chan; import comm::send; import comm; import comm::port; import comm::recv; -enum request { quit, close(chan), } +enum request { quit, close(Chan), } -type ctx = chan; +type ctx = Chan; -fn request_task(c: chan) { +fn request_task(c: Chan) { let p = port(); send(c, chan(p)); let mut req: request; diff --git a/src/test/run-pass/comm.rs b/src/test/run-pass/comm.rs index d5be0affdb918..e84b844a1ea72 100644 --- a/src/test/run-pass/comm.rs +++ b/src/test/run-pass/comm.rs @@ -2,6 +2,7 @@ use std; import comm; +import comm::Chan; import comm::chan; import comm::send; import comm::recv; @@ -17,7 +18,7 @@ fn main() { assert (y == 10); } -fn child(c: chan) { +fn child(c: Chan) { error!{"sending"}; send(c, 10); error!{"value sent"}; diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index d0098dd8afe2e..6d54dd37ef6d1 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -14,6 +14,7 @@ import vec; import std::map; import std::map::hashmap; import task; +import comm::Chan; import comm::chan; import comm::port; import comm::send; @@ -31,18 +32,18 @@ mod map_reduce { type mapper = extern fn(~str, putter); - enum ctrl_proto { find_reducer(~[u8], chan), mapper_done, } + enum ctrl_proto { find_reducer(~[u8], Chan), mapper_done, } - fn start_mappers(ctrl: chan, inputs: ~[~str]) { + fn start_mappers(ctrl: Chan, inputs: ~[~str]) { for inputs.each |i| { task::spawn(|| map_task(ctrl, i) ); } } - fn map_task(ctrl: chan, input: ~str) { + fn map_task(ctrl: Chan, input: ~str) { let intermediates = map::str_hash(); - fn emit(im: map::hashmap<~str, int>, ctrl: chan, key: ~str, + fn emit(im: map::hashmap<~str, int>, ctrl: Chan, key: ~str, val: ~str) { let mut c; match im.find(key) { diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 315c334f4721a..a55024097a083 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -10,14 +10,14 @@ mod pipes { type packet = { mut state: state, - mut blocked_task: option, + mut blocked_task: option, mut payload: option }; fn packet() -> *packet unsafe { let p: *packet = unsafe::transmute(~{ mut state: empty, - mut blocked_task: none::, + mut blocked_task: none::, mut payload: none:: }); p diff --git a/src/test/run-pass/issue-507.rs b/src/test/run-pass/issue-507.rs index f1dab3d8a0a05..4fec03ff711c4 100644 --- a/src/test/run-pass/issue-507.rs +++ b/src/test/run-pass/issue-507.rs @@ -9,14 +9,15 @@ use std; import task; import comm; +import comm::Chan; import comm::chan; import comm::send; import comm::port; import comm::recv; -fn grandchild(c: chan) { send(c, 42); } +fn grandchild(c: Chan) { send(c, 42); } -fn child(c: chan) { +fn child(c: Chan) { task::spawn(|| grandchild(c) ) } diff --git a/src/test/run-pass/issue-687.rs b/src/test/run-pass/issue-687.rs index f8f983d767fba..1738f45c6a8fd 100644 --- a/src/test/run-pass/issue-687.rs +++ b/src/test/run-pass/issue-687.rs @@ -2,21 +2,23 @@ use std; import vec; import task; import comm; +import comm::Chan; import comm::chan; +import comm::Port; import comm::port; import comm::recv; import comm::send; enum msg { closed, received(~[u8]), } -fn producer(c: chan<~[u8]>) { +fn producer(c: Chan<~[u8]>) { send(c, ~[1u8, 2u8, 3u8, 4u8]); let empty: ~[u8] = ~[]; send(c, empty); } -fn packager(cb: chan>, msg: chan) { - let p: port<~[u8]> = port(); +fn packager(cb: Chan>, msg: Chan) { + let p: Port<~[u8]> = port(); send(cb, chan(p)); loop { debug!{"waiting for bytes"}; @@ -37,13 +39,13 @@ fn packager(cb: chan>, msg: chan) { } fn main() { - let p: port = port(); + let p: Port = port(); let ch = chan(p); - let recv_reader: port> = port(); + let recv_reader: Port> = port(); let recv_reader_chan = chan(recv_reader); let pack = task::spawn(|| packager(recv_reader_chan, ch) ); - let source_chan: chan<~[u8]> = recv(recv_reader); + let source_chan: Chan<~[u8]> = recv(recv_reader); let prod = task::spawn(|| producer(source_chan) ); loop { diff --git a/src/test/run-pass/issue-783.rs b/src/test/run-pass/issue-783.rs index b826eaa620c7e..5a970c46ec2fa 100644 --- a/src/test/run-pass/issue-783.rs +++ b/src/test/run-pass/issue-783.rs @@ -4,7 +4,7 @@ import task::*; fn a() { fn doit() { - fn b(c: chan>) { + fn b(c: Chan>) { let p = port(); send(c, chan(p)); } diff --git a/src/test/run-pass/ivec-tag.rs b/src/test/run-pass/ivec-tag.rs index 26cd2f6a1f5b3..85ac1a0101954 100644 --- a/src/test/run-pass/ivec-tag.rs +++ b/src/test/run-pass/ivec-tag.rs @@ -2,19 +2,21 @@ use std; import task; import comm; +import comm::Chan; import comm::chan; +import comm::Port; import comm::port; import comm::send; import comm::recv; -fn producer(c: chan<~[u8]>) { +fn producer(c: Chan<~[u8]>) { send(c, ~[1u8, 2u8, 3u8, 4u8, 5u8, 6u8, 7u8, 8u8, 9u8, 10u8, 11u8, 12u8, 13u8]); } fn main() { - let p: port<~[u8]> = port(); + let p: Port<~[u8]> = port(); let ch = chan(p); let prod = task::spawn(|| producer(ch) ); diff --git a/src/test/run-pass/lazychan.rs b/src/test/run-pass/lazychan.rs index 8f5bffebf211d..c8c532e101858 100644 --- a/src/test/run-pass/lazychan.rs +++ b/src/test/run-pass/lazychan.rs @@ -22,4 +22,4 @@ fn main() { assert (y == 10); } -fn child(c: chan) { send(c, 10); } +fn child(c: Chan) { send(c, 10); } diff --git a/src/test/run-pass/many.rs b/src/test/run-pass/many.rs index bdecc4b4f9871..dde39ae37ed3a 100644 --- a/src/test/run-pass/many.rs +++ b/src/test/run-pass/many.rs @@ -4,7 +4,7 @@ use std; import task; import comm; -fn sub(parent: comm::chan, id: int) { +fn sub(parent: comm::Chan, id: int) { if id == 0 { comm::send(parent, 0); } else { diff --git a/src/test/run-pass/platform_thread.rs b/src/test/run-pass/platform_thread.rs index 9b26744870a2c..1878dd4618730 100644 --- a/src/test/run-pass/platform_thread.rs +++ b/src/test/run-pass/platform_thread.rs @@ -14,9 +14,9 @@ fn run(i: int) { return; } - do task::task().sched_mode(task::platform_thread).unlinked().spawn { + do task::task().sched_mode(task::PlatformThread).unlinked().spawn { task::yield(); - do task::task().sched_mode(task::single_threaded).unlinked().spawn { + do task::task().sched_mode(task::SingleThreaded).unlinked().spawn { task::yield(); run(i - 1); task::yield(); diff --git a/src/test/run-pass/send-type-inference.rs b/src/test/run-pass/send-type-inference.rs index 432985bcb7fa1..a5e9867943f5c 100644 --- a/src/test/run-pass/send-type-inference.rs +++ b/src/test/run-pass/send-type-inference.rs @@ -1,4 +1,5 @@ use std; +import comm::Chan; import comm::chan; import comm::send; import comm::port; @@ -6,7 +7,7 @@ import comm::port; // tests that ctrl's type gets inferred properly type command = {key: K, val: V}; -fn cache_server(c: chan>>) { +fn cache_server(c: Chan>>) { let ctrl = port(); send(c, chan(ctrl)); } diff --git a/src/test/run-pass/spawn-types.rs b/src/test/run-pass/spawn-types.rs index a6877c667f626..0c2dda20035f3 100644 --- a/src/test/run-pass/spawn-types.rs +++ b/src/test/run-pass/spawn-types.rs @@ -10,7 +10,7 @@ import str; import comm; import task; -type ctx = comm::chan; +type ctx = comm::Chan; fn iotask(cx: ctx, ip: ~str) { assert (ip == ~"localhost"); diff --git a/src/test/run-pass/task-comm-chan-cleanup4.rs b/src/test/run-pass/task-comm-chan-cleanup4.rs index e5e6ed08fc73a..65762cae08cc2 100644 --- a/src/test/run-pass/task-comm-chan-cleanup4.rs +++ b/src/test/run-pass/task-comm-chan-cleanup4.rs @@ -6,7 +6,7 @@ import task; // 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: comm::Chan<~str>) { for int::range(0, 10) |_i| { comm::send(ch, ~"pew pew"); } diff --git a/src/test/run-pass/task-comm.rs b/src/test/run-pass/task-comm.rs index 892d12733b570..399ce8e808bbc 100644 --- a/src/test/run-pass/task-comm.rs +++ b/src/test/run-pass/task-comm.rs @@ -3,6 +3,7 @@ use std; import task; import task::task; import comm; +import comm::Chan; import comm::chan; import comm::port; import comm::send; @@ -17,7 +18,7 @@ fn main() { test06(); } -fn test00_start(ch: chan, message: int, count: int) { +fn test00_start(ch: Chan, message: int, count: int) { debug!{"Starting test00_start"}; let mut i: int = 0; while i < count { @@ -93,7 +94,7 @@ fn test04() { debug!{"Finishing up."}; } -fn test05_start(ch: chan) { +fn test05_start(ch: Chan) { send(ch, 10); send(ch, 20); send(ch, 30); diff --git a/src/test/run-pass/task-killjoin-rsrc.rs b/src/test/run-pass/task-killjoin-rsrc.rs index 4349b75afc3a7..4c061f152f4e2 100644 --- a/src/test/run-pass/task-killjoin-rsrc.rs +++ b/src/test/run-pass/task-killjoin-rsrc.rs @@ -7,8 +7,8 @@ use std; import task; class notify { - let ch: comm::chan; let v: @mut bool; - new(ch: comm::chan, v: @mut bool) { self.ch = ch; self.v = v; } + let ch: comm::Chan; let v: @mut bool; + new(ch: comm::Chan, v: @mut bool) { self.ch = ch; self.v = v; } drop { error!{"notify: task=%? v=%x unwinding=%b b=%b", task::get_task(), @@ -20,8 +20,8 @@ class notify { } } -fn joinable(+f: fn~()) -> comm::port { - fn wrapper(+c: comm::chan, +f: fn()) { +fn joinable(+f: fn~()) -> comm::Port { + fn wrapper(+c: comm::Chan, +f: fn()) { let b = @mut false; error!{"wrapper: task=%? allocated v=%x", task::get_task(), @@ -36,7 +36,7 @@ fn joinable(+f: fn~()) -> comm::port { p } -fn join(port: comm::port) -> bool { +fn join(port: comm::Port) -> bool { comm::recv(port) } diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 7169993f664f9..89da4e65f88aa 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -3,7 +3,7 @@ import comm; import task; import uint; -fn child(c: comm::chan<~uint>, i: uint) { +fn child(c: comm::Chan<~uint>, i: uint) { comm::send(c, ~i); } diff --git a/src/test/run-pass/unwind-resource.rs b/src/test/run-pass/unwind-resource.rs index ac5f0d07f0a68..39b619c590513 100644 --- a/src/test/run-pass/unwind-resource.rs +++ b/src/test/run-pass/unwind-resource.rs @@ -4,8 +4,8 @@ import task; import comm; class complainer { - let c: comm::chan; - new(c: comm::chan) { + let c: comm::Chan; + new(c: comm::Chan) { error!{"Hello!"}; self.c = c; } drop { error!{"About to send!"}; @@ -13,7 +13,7 @@ class complainer { error!{"Sent!"}; } } -fn f(c: comm::chan) { +fn f(c: comm::Chan) { let _c <- complainer(c); fail; }