Drop the 2 from the spawn*2 functions

Issue #1022
This commit is contained in:
Brian Anderson 2011-10-13 21:23:07 -07:00
parent e0bba33caa
commit 686d6a485f
61 changed files with 107 additions and 107 deletions

View File

@ -191,7 +191,7 @@ fn closure_to_task(cx: cx, configport: port<[u8]>, testfn: fn()) ->
testfn();
let testfile = recv(configport);
ret task::spawn_joinable2(
ret task::spawn_joinable(
(cx.config, cx.procsrv.chan, testfile), run_test_task);
}

View File

@ -37,7 +37,7 @@
fn mk() -> handle {
let setupport = port();
let task = task::spawn_joinable2(
let task = task::spawn_joinable(
chan(setupport),
fn# (setupchan: chan<chan<request>>) {
let reqport = port();

View File

@ -107,7 +107,7 @@ fn new_client(client: client, evt: chan<socket_event>) {
if rustrt::aio_is_null_client(client) {
log "client was actually null, returning";
ret;
} else { task::spawn2((client, events), accept_task); }
} else { task::spawn((client, events), accept_task); }
}
}
@ -129,10 +129,10 @@ fn new_client(client: client, evt: chan<socket_event>) {
ret;
}
connect(remote(ip, portnum), client) {
task::spawn2((ip, portnum, client), connect_task);
task::spawn((ip, portnum, client), connect_task);
}
serve(ip, portnum, events, server) {
task::spawn2((ip, portnum, events, server), server_task);
task::spawn((ip, portnum, events, server), server_task);
}
write(socket, v, status) unsafe {
rustrt::aio_writedata(socket, vec::unsafe::to_ptr::<u8>(v),
@ -157,7 +157,7 @@ fn new_client(client: client, evt: chan<socket_event>) {
log "io task init";
// Spawn our request task
let reqtask = task::spawn_joinable2(c, request_task);
let reqtask = task::spawn_joinable(c, request_task);
log "uv run task init";
// Enter IO loop. This never returns until aio_stop is called.
@ -169,7 +169,7 @@ fn new_client(client: client, evt: chan<socket_event>) {
fn new() -> ctx {
let p: port<ctx> = port();
task::spawn2(chan(p), iotask);
task::spawn(chan(p), iotask);
ret recv(p);
}

View File

@ -18,9 +18,9 @@
export tr_success;
export tr_failure;
export get_task_id;
export spawn2;
export spawn_notify2;
export spawn_joinable2;
export spawn;
export spawn_notify;
export spawn_joinable;
native "rust" mod rustrt {
fn task_sleep(time_in_us: uint);
@ -93,18 +93,18 @@ fn join_id(t: task_id) -> task_result {
fn set_min_stack(stack_size: uint) { rustrt::set_min_stack(stack_size); }
fn spawn2<~T>(-data: T, f: fn#(T)) -> task {
fn spawn<~T>(-data: T, f: fn#(T)) -> task {
spawn_inner2(data, f, none)
}
fn spawn_notify2<~T>(-data: T, f: fn#(T),
fn spawn_notify<~T>(-data: T, f: fn#(T),
notify: comm::chan<task_notification>) -> task {
spawn_inner2(data, f, some(notify))
}
fn spawn_joinable2<~T>(-data: T, f: fn#(T)) -> joinable_task {
fn spawn_joinable<~T>(-data: T, f: fn#(T)) -> joinable_task {
let p = comm::port::<task_notification>();
let id = spawn_notify2(data, f, comm::chan::<task_notification>(p));
let id = spawn_notify(data, f, comm::chan::<task_notification>(p));
ret (id, p);
}

View File

@ -325,7 +325,7 @@ fn default_test_to_task(&&f: default_test_fn) -> joinable {
configure_test_task();
f();
}
ret task::spawn_joinable2(f, run_task);
ret task::spawn_joinable(f, run_task);
}
// Call from within a test task to make sure it's set up correctly

View File

@ -36,15 +36,15 @@ fn fib(n: int) -> int {
} else {
let p = port();
let t1 = task::spawn2((chan(p), n - 1), pfib);
let t2 = task::spawn2((chan(p), n - 2), pfib);
let t1 = task::spawn((chan(p), n - 1), pfib);
let t2 = task::spawn((chan(p), n - 2), pfib);
send(c, recv(p) + recv(p));
}
}
let p = port();
let t = task::spawn2((chan(p), n), pfib);
let t = task::spawn((chan(p), n), pfib);
ret recv(p);
}
@ -75,7 +75,7 @@ fn parse_opts(argv: [str]) -> config {
fn stress(num_tasks: int) {
let tasks = [];
for each i: int in range(0, num_tasks) {
tasks += [task::spawn_joinable2(copy i, stress_task)];
tasks += [task::spawn_joinable(copy i, stress_task)];
}
for t in tasks { task::join(t); }
}

View File

@ -7,7 +7,7 @@
fn# f(&&n: uint) {
let i = 0u;
while i < n {
task::join(task::spawn_joinable2((), g));
task::join(task::spawn_joinable((), g));
i += 1u;
}
}
@ -20,5 +20,5 @@ fn main(args: [str]) {
10u
} else { uint::parse_buf(str::bytes(args[1]), 10u) };
let i = 0u;
while i < n { task::spawn2(copy n, f); i += 1u; }
while i < n { task::spawn(copy n, f); i += 1u; }
}

View File

@ -21,5 +21,5 @@ fn main(args: [str]) {
if vec::len(args) < 2u {
100u
} else { uint::parse_buf(str::bytes(args[1]), 10u) };
for each i in uint::range(0u, 100u) { task::spawn2(copy n, f); }
for each i in uint::range(0u, 100u) { task::spawn(copy n, f); }
}

View File

@ -70,7 +70,7 @@ fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) ->
[joinable_task] {
let tasks = [];
for i: str in inputs {
tasks += [task::spawn_joinable2((ctrl, i), map_task)];
tasks += [task::spawn_joinable((ctrl, i), map_task)];
}
ret tasks;
}
@ -171,7 +171,7 @@ fn map_reduce(inputs: [str]) {
// log_err "creating new reducer for " + k;
let p = port();
tasks +=
[task::spawn_joinable2((k, chan(p)), reduce_task)];
[task::spawn_joinable((k, chan(p)), reduce_task)];
c = recv(p);
reducers.insert(k, c);
}

View File

@ -5,4 +5,4 @@
fn# f(&&x: int) -> int { ret x; }
fn main() { task::spawn2(10, f); }
fn main() { task::spawn(10, f); }

View File

@ -10,6 +10,6 @@
fn main() {
let p = port::<int>();
task::spawn2((), child);
task::spawn((), child);
let x = recv(p);
}

View File

@ -11,6 +11,6 @@
fn main() {
let p = port::<int>();
task::spawn2((), child);
task::spawn((), child);
task::yield();
}

View File

@ -10,12 +10,12 @@
fn# child(&&_i: ()) {
let p = port::<int>();
task::spawn2((), grandchild);
task::spawn((), grandchild);
let x = recv(p);
}
fn main() {
let p = port::<int>();
task::spawn2((), child);
task::spawn((), child);
let x = recv(p);
}

View File

@ -10,7 +10,7 @@
}
fn main() {
task::spawn2((), goodfail);
task::spawn((), goodfail);
let po = comm::port();
// We shouldn't be able to get past this recv since there's no
// message available

View File

@ -11,8 +11,8 @@
fn main() {
let p = port();
task::spawn2(chan(p), a);
task::spawn2(chan(p), a);
task::spawn(chan(p), a);
task::spawn(chan(p), a);
let n: int = 0;
n = recv(p);
n = recv(p);

View File

@ -11,8 +11,8 @@
fn main() {
let p = comm::port();
task::spawn2(chan(p), a);
task::spawn2(chan(p), b);
task::spawn(chan(p), a);
task::spawn(chan(p), b);
let n: int = 0;
n = recv(p);
n = recv(p);

View File

@ -26,8 +26,8 @@ fn main() {
let n: int = 2 + 3 * 7;
let s: str = "hello there";
let p = comm::port();
task::spawn2(chan(p), a);
task::spawn2(chan(p), b);
task::spawn(chan(p), a);
task::spawn(chan(p), b);
let x: int = 10;
x = g(n, s);
log x;

View File

@ -89,8 +89,8 @@ fn test_ptr() {
fn test_task() {
fn# f(&&_i: ()) { }
let f1 = f, f2 = f;
let t1 = task::spawn2((), f1);
let t2 = task::spawn2((), f2);
let t1 = task::spawn((), f1);
let t2 = task::spawn((), f2);
assert (t1 == t1);
assert (t1 != t2);

View File

@ -23,7 +23,7 @@
fn new() -> ctx {
let p = port();
let t = task::spawn2(chan(p), request_task);
let t = task::spawn(chan(p), request_task);
let cx: ctx;
cx = recv(p);
ret cx;

View File

@ -5,4 +5,4 @@
fn# child2(&&s: str) { }
fn main() { let x = task::spawn2("hi", child2); }
fn main() { let x = task::spawn("hi", child2); }

View File

@ -9,7 +9,7 @@
fn main() {
let p = comm::port();
let t = task::spawn2(chan(p), child);
let t = task::spawn(chan(p), child);
let y = recv(p);
log_err "received";
log_err y;

View File

@ -33,7 +33,7 @@ mod map_reduce {
tag ctrl_proto { find_reducer([u8], chan<int>); mapper_done; }
fn start_mappers(ctrl: chan<ctrl_proto>, inputs: [str]) {
for i: str in inputs { task::spawn2((ctrl, i), map_task); }
for i: str in inputs { task::spawn((ctrl, i), map_task); }
}
fn# map_task(&&args: (chan<ctrl_proto>, str)) {

View File

@ -11,4 +11,4 @@
fn# yield_wrap(&&_i: ()) unsafe { rustrt::task_yield(); }
fn main() { task::spawn2((), yield_wrap); }
fn main() { task::spawn((), yield_wrap); }

View File

@ -18,14 +18,14 @@
fn# grandchild(c: chan<int>) { send(c, 42); }
fn# child(c: chan<int>) {
let _grandchild = task::spawn_joinable2(c, grandchild);
let _grandchild = task::spawn_joinable(c, grandchild);
join(_grandchild);
}
fn main() {
let p = comm::port();
let _child = task::spawn_joinable2(chan(p), child);
let _child = task::spawn_joinable(chan(p), child);
let x: int = recv(p);

View File

@ -37,10 +37,10 @@
fn main() {
let p: port<msg> = port();
let recv_reader: port<chan<[u8]>> = port();
let pack = task::spawn2((chan(recv_reader), chan(p)), packager);
let pack = task::spawn((chan(recv_reader), chan(p)), packager);
let source_chan: chan<[u8]> = recv(recv_reader);
let prod = task::spawn2(source_chan, producer);
let prod = task::spawn(source_chan, producer);
while true {
let msg = recv(p);

View File

@ -15,7 +15,7 @@
fn main() {
let p: port<[u8]> = port();
let prod = task::spawn2(chan(p), producer);
let prod = task::spawn(chan(p), producer);
let data: [u8] = recv(p);
}

View File

@ -5,7 +5,7 @@
import std::task::*;
fn main() {
let other = spawn_joinable2((), child);
let other = spawn_joinable((), child);
log_err "1";
yield();
join(other);

View File

@ -8,13 +8,13 @@ fn main() {
let p = port();
let y: int;
task::spawn2(chan(p), child);
task::spawn(chan(p), child);
y = recv(p);
log "received 1";
log y;
assert (y == 10);
task::spawn2(chan(p), child);
task::spawn(chan(p), child);
y = recv(p);
log "received 2";
log y;

View File

@ -12,10 +12,10 @@
// process
task::unsupervise();
let p = port::<int>();
task::spawn2((), child);
task::spawn((), child);
let x = recv(p);
}
fn main() {
task::spawn2((), parent);
task::spawn((), parent);
}

View File

@ -10,11 +10,11 @@
fn# iloop(&&_i: ()) {
task::unsupervise();
task::spawn2((), die);
task::spawn((), die);
}
fn main() {
for each i in uint::range(0u, 100u) {
task::spawn2((), iloop);
task::spawn((), iloop);
}
}

View File

@ -10,7 +10,7 @@
comm::send(parent, 0);
} else {
let p = comm::port();
let child = task::spawn2((comm::chan(p), id - 1), sub);
let child = task::spawn((comm::chan(p), id - 1), sub);
let y = comm::recv(p);
comm::send(parent, y + 1);
}
@ -18,7 +18,7 @@
fn main() {
let p = comm::port();
let child = task::spawn2((comm::chan(p), 200), sub);
let child = task::spawn((comm::chan(p), 200), sub);
let y = comm::recv(p);
log "transmission complete";
log y;

View File

@ -10,7 +10,7 @@
fn# iloop(&&_i: ()) {
task::unsupervise();
task::spawn2((), die);
task::spawn((), die);
let p = comm::port::<()>();
let c = comm::chan(p);
while true {
@ -20,6 +20,6 @@
fn main() {
for each i in uint::range(0u, 16u) {
task::spawn2((), iloop);
task::spawn((), iloop);
}
}

View File

@ -10,9 +10,9 @@
}
fn main() {
task::spawn2(("hello from first spawned fn", 65), x);
task::spawn2(("hello from second spawned fn", 66), x);
task::spawn2(("hello from third spawned fn", 67), x);
task::spawn(("hello from first spawned fn", 65), x);
task::spawn(("hello from second spawned fn", 66), x);
task::spawn(("hello from third spawned fn", 67), x);
let i: int = 30;
while i > 0 { i = i - 1; log "parent sleeping"; yield(); }
}

View File

@ -1,8 +1,8 @@
use std;
import std::task::join;
import std::task::spawn_joinable2;
import std::task::spawn_joinable;
fn main() { let x = spawn_joinable2(10, m::child); join(x); }
fn main() { let x = spawn_joinable(10, m::child); join(x); }
mod m {
fn# child(&&i: int) { log i; }

View File

@ -19,5 +19,5 @@
fn main() {
let p = comm::port::<int>();
task::spawn2((comm::chan(p), "localhost"), iotask);
task::spawn((comm::chan(p), "localhost"), iotask);
}

View File

@ -4,7 +4,7 @@
import std::task;
fn main() { let t = task::spawn_joinable2(10, child); task::join(t); }
fn main() { let t = task::spawn_joinable(10, child); task::join(t); }
fn# child(&&i: int) { log_err i; assert (i == 10); }

View File

@ -1,9 +1,9 @@
// -*- rust -*-
use std;
import std::task::spawn2;
import std::task::spawn;
fn main() { spawn2((10, 20, 30, 40, 50, 60, 70, 80, 90), child); }
fn main() { spawn((10, 20, 30, 40, 50, 60, 70, 80, 90), child); }
fn# child(&&args: (int, int, int, int, int, int, int, int, int)) {
let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args;

View File

@ -20,7 +20,7 @@
fn test05() {
let po = comm::port();
let ch = comm::chan(po);
task::spawn2(ch, test05_start);
task::spawn(ch, test05_start);
let value = comm::recv(po);
log_err value;
value = comm::recv(po);

View File

@ -1,6 +1,6 @@
use std;
import std::task::spawn_joinable2;
import std::task::spawn_joinable;
import std::task::join;
fn main() { test00(); }
@ -8,7 +8,7 @@
fn# start(&&_i: ()) { log "Started / Finished task."; }
fn test00() {
let t = spawn_joinable2((), start);
let t = spawn_joinable((), start);
join(t);
log "Completing.";
}

View File

@ -18,7 +18,7 @@
fn main() {
let p = comm::port();
let child = task::spawn2(comm::chan(p), start);
let child = task::spawn(comm::chan(p), start);
let c = comm::recv(p);
comm::send(c, "A");

View File

@ -9,6 +9,6 @@
fn main() {
let p = comm::port();
let child = task::spawn2(comm::chan(p), start);
let child = task::spawn(comm::chan(p), start);
let c = comm::recv(p);
}

View File

@ -7,7 +7,7 @@
fn test00() {
let i: int = 0;
let t = task::spawn_joinable2(i, start);
let t = task::spawn_joinable(i, start);
// Sleep long enough for the task to finish.
task::sleep(10000u);

View File

@ -12,7 +12,7 @@
fn main() {
log "Check that we don't deadlock.";
let p = comm::port::<int>();
let a = task::spawn_joinable2((comm::chan(p), 0, 10), start);
let a = task::spawn_joinable((comm::chan(p), 0, 10), start);
task::join(a);
log "Joined task";
}

View File

@ -9,7 +9,7 @@ fn main() {
let i = 10;
while (i > 0) {
log i;
task::spawn2((i, comm::chan(po)), child);
task::spawn((i, comm::chan(po)), child);
i = i - 1;
}

View File

@ -12,5 +12,5 @@ fn f() {
}
fn main() {
task::spawn2(bind f());
task::spawn(bind f());
}

View File

@ -19,7 +19,7 @@ fn test00() {
let tasks = [];
while i < number_of_tasks {
i = i + 1;
tasks += [task::spawn_joinable2(copy i, start)];
tasks += [task::spawn_joinable(copy i, start)];
}
for t in tasks { task::join(t); }

View File

@ -33,7 +33,7 @@ fn test00() {
// Create and spawn tasks...
let tasks = [];
while i < number_of_tasks {
tasks += [task::spawn_joinable2(
tasks += [task::spawn_joinable(
(ch, i, number_of_messages), test00_start)];
i = i + 1;
}

View File

@ -20,19 +20,19 @@ fn test00() {
let number_of_messages: int = 10;
let t0 =
task::spawn_joinable2((chan(p),
task::spawn_joinable((chan(p),
number_of_messages * 0,
number_of_messages), test00_start);
let t1 =
task::spawn_joinable2((chan(p),
task::spawn_joinable((chan(p),
number_of_messages * 1,
number_of_messages), test00_start);
let t2 =
task::spawn_joinable2((chan(p),
task::spawn_joinable((chan(p),
number_of_messages * 2,
number_of_messages), test00_start);
let t3 =
task::spawn_joinable2((chan(p),
task::spawn_joinable((chan(p),
number_of_messages * 3,
number_of_messages), test00_start);

View File

@ -17,19 +17,19 @@ fn test00() {
let number_of_messages: int = 10;
let t0 =
task::spawn_joinable2((comm::chan(p),
task::spawn_joinable((comm::chan(p),
number_of_messages * 0,
number_of_messages), test00_start);
let t1 =
task::spawn_joinable2((comm::chan(p),
task::spawn_joinable((comm::chan(p),
number_of_messages * 1,
number_of_messages), test00_start);
let t2 =
task::spawn_joinable2((comm::chan(p),
task::spawn_joinable((comm::chan(p),
number_of_messages * 2,
number_of_messages), test00_start);
let t3 =
task::spawn_joinable2((comm::chan(p),
task::spawn_joinable((comm::chan(p),
number_of_messages * 3,
number_of_messages), test00_start);

View File

@ -16,7 +16,7 @@ fn test00() {
let p = comm::port();
let number_of_messages: int = 10;
let t0 = task::spawn_joinable2((comm::chan(p), number_of_messages),
let t0 = task::spawn_joinable((comm::chan(p), number_of_messages),
test00_start);
let i: int = 0;

View File

@ -1,6 +1,6 @@
use std;
import std::task;
fn main() { task::spawn2("Hello", child); }
fn main() { task::spawn("Hello", child); }
fn# child(&&s: str) {

View File

@ -11,13 +11,13 @@
fn test_fail() {
fn# f(&&_i: ()) { std::task::unsupervise(); let x: @int = fail; }
std::task::spawn2((), f);
std::task::spawn((), f);
}
fn test_fail_indirect() {
fn f() -> ! { fail; }
fn# g(&&_i: ()) { std::task::unsupervise(); let x: @int = f(); }
std::task::spawn2((), g);
std::task::spawn((), g);
}
fn main() {

View File

@ -5,7 +5,7 @@
fn main() {
let i = 10;
while i > 0 { task::spawn2(copy i, child); i = i - 1; }
while i > 0 { task::spawn(copy i, child); i = i - 1; }
log "main thread exiting";
}

View File

@ -13,7 +13,7 @@ fn main() {
let n = 100u;
let expected = 0u;
for each i in uint::range(0u, n) {
task::spawn2((comm::chan(p), i), child);
task::spawn((comm::chan(p), i), child);
expected += i;
}

View File

@ -9,5 +9,5 @@
}
fn main() {
task::spawn2((), f);
task::spawn((), f);
}

View File

@ -16,6 +16,6 @@
fn main() {
let p = comm::port();
let c = comm::chan(p);
task::spawn2(c, f);
task::spawn(c, f);
assert comm::recv(p);
}

View File

@ -13,5 +13,5 @@
}
fn main() {
task::spawn2((), f);
task::spawn((), f);
}

View File

@ -9,5 +9,5 @@
}
fn main() {
task::spawn2((), f);
task::spawn((), f);
}

View File

@ -4,7 +4,7 @@
import std::task::*;
fn main() {
let other = task::spawn_joinable2((), child);
let other = task::spawn_joinable((), child);
log_err "1";
yield();
log_err "2";

View File

@ -4,7 +4,7 @@
import std::task::*;
fn main() {
let other = task::spawn_joinable2((), child);
let other = task::spawn_joinable((), child);
log_err "1";
yield();
join(other);

View File

@ -8,19 +8,19 @@
#[test]
fn test_unsupervise() {
fn# f(&&_i: ()) { task::unsupervise(); fail; }
task::spawn2((), f);
task::spawn((), f);
}
#[test]
fn test_lib_spawn() {
fn# foo(&&_i: ()) { log_err "Hello, World!"; }
task::spawn2((), foo);
task::spawn((), foo);
}
#[test]
fn test_lib_spawn2() {
fn# foo(&&x: int) { assert (x == 42); }
task::spawn2(42, foo);
task::spawn(42, foo);
}
#[test]
@ -28,7 +28,7 @@ fn test_join_chan() {
fn# winner(&&_i: ()) { }
let p = comm::port();
task::spawn_notify2((), winner, comm::chan(p));
task::spawn_notify((), winner, comm::chan(p));
let s = comm::recv(p);
log_err "received task status message";
log_err s;
@ -43,7 +43,7 @@ fn test_join_chan_fail() {
fn# failer(&&_i: ()) { task::unsupervise(); fail }
let p = comm::port();
task::spawn_notify2((), failer, comm::chan(p));
task::spawn_notify((), failer, comm::chan(p));
let s = comm::recv(p);
log_err "received task status message";
log_err s;
@ -56,7 +56,7 @@ fn test_join_chan_fail() {
#[test]
fn test_join_convenient() {
fn# winner(&&_i: ()) { }
let handle = task::spawn_joinable2((), winner);
let handle = task::spawn_joinable((), winner);
assert (task::tr_success == task::join(handle));
}
@ -66,6 +66,6 @@ fn spawn_polymorphic() {
// FIXME #1038: Can't spawn palymorphic functions
/*fn# foo<~T>(x: T) { log_err x; }
task::spawn2(true, foo);
task::spawn2(42, foo);*/
task::spawn(true, foo);
task::spawn(42, foo);*/
}