test::joinable {
testfn();
let testfile = recv(configport);
-
- ret task::spawn_joinable(
- (cx.config, cx.procsrv.chan, testfile), run_test_task);
+ let (config, chan) = (cx.config, cx.procsrv.chan);
+ ret task::spawn_joinable {||
+ run_test_task(config, chan, testfile);
+ };
}
-fn run_test_task(args: (common::config, procsrv::reqchan, [u8])) {
-
- let (config, procsrv_chan, testfile) = args;
-
+fn run_test_task(config: common::config,
+ procsrv_chan: procsrv::reqchan,
+ testfile: [u8]) {
test::configure_test_task();
let procsrv = procsrv::from_chan(procsrv_chan);
let cx = {config: config, procsrv: procsrv};
- runtest::run(cx, testfile);
+ runtest::run(cx, copy testfile);
}
// Local Variables:
fn mk() -> handle {
let setupport = port();
- let task = task::spawn_joinable(
- chan(setupport),
- fn (setupchan: chan<chan<request>>) {
- let reqport = port();
- let reqchan = chan(reqport);
- send(setupchan, reqchan);
- worker(reqport);
- });
+ let setupchan = chan(setupport);
+ let task = task::spawn_joinable {||
+ let reqport = port();
+ let reqchan = chan(reqport);
+ send(setupchan, reqchan);
+ worker(reqport);
+ };
ret {task: option::some(task), chan: recv(setupport)};
}
fn main() {
let p = port();
- task::spawn(chan(p), a);
- task::spawn(chan(p), a);
+ let ch = chan(p);
+ task::spawn {|| a(ch); };
+ task::spawn {|| a(ch); };
let n: int = 0;
n = recv(p);
n = recv(p);
use std;
import comm;
+import comm::port;
import comm::send;
import comm::chan;
import comm::recv;
fn a(c: chan<int>) { #debug("task a0"); #debug("task a1"); send(c, 10); }
fn main() {
- let p = comm::port();
- task::spawn(chan(p), a);
- task::spawn(chan(p), b);
+ let p = port();
+ let ch = chan(p);
+ task::spawn {|| a(ch); };
+ task::spawn {|| b(ch); };
let n: int = 0;
n = recv(p);
n = recv(p);
let n: int = 2 + 3 * 7;
let s: str = "hello there";
let p = comm::port();
- task::spawn(chan(p), a);
- task::spawn(chan(p), b);
+ let ch = comm::chan(p);
+ task::spawn {|| a(ch); };
+ task::spawn {|| b(ch); };
let x: int = 10;
x = g(n, s);
log(debug, x);
}
fn test_task() {
- fn f(&&_i: ()) { }
+ fn f() { }
let f1 = f, f2 = f;
- let t1 = task::spawn((), f1);
- let t2 = task::spawn((), f2);
+ let t1 = task::spawn {|| f1(); };
+ let t2 = task::spawn {|| f2(); };
assert (t1 == t1);
assert (t1 != t2);
fn new() -> ctx {
let p = port();
- let t = task::spawn(chan(p), request_task);
+ let ch = chan(p);
+ let t = task::spawn {|| request_task(ch); };
let cx: ctx;
cx = recv(p);
ret cx;
fn child2(&&s: str) { }
-fn main() { let x = task::spawn("hi", child2); }
+fn main() { let x = task::spawn {|| child2("hi"); }; }
fn main() {
let p = comm::port();
- let t = task::spawn(chan(p), child);
+ let ch = comm::chan(p);
+ let t = task::spawn {|| child(ch); };
let y = recv(p);
#error("received");
log(error, y);
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::spawn((ctrl, i), map_task); }
+ for i: str in inputs {
+ task::spawn {|| map_task(ctrl, i); };
+ }
}
- fn map_task(&&args: (chan<ctrl_proto>, str)) {
- let (ctrl, input) = args;
-
+ fn map_task(ctrl: chan<ctrl_proto>, input: str) {
let intermediates = map::new_str_hash();
fn emit(im: map::hashmap<str, int>, ctrl: chan<ctrl_proto>, key: str,
fn grandchild(c: chan<int>) { send(c, 42); }
fn child(c: chan<int>) {
- let _grandchild = task::spawn_joinable(copy c, grandchild);
+ let _grandchild = task::spawn_joinable {|| grandchild(c); };
join(_grandchild);
}
fn main() {
let p = comm::port();
+ let ch = chan(p);
- let _child = task::spawn_joinable(chan(p), child);
+ let _child = task::spawn_joinable {|| child(ch); };
let x: int = recv(p);
send(c, empty);
}
-fn packager(&&args: (chan<chan<[u8]>>, chan<msg>)) {
- let (cb, msg) = args;
+fn packager(cb: chan<chan<[u8]>>, msg: chan<msg>) {
let p: port<[u8]> = port();
send(cb, chan(p));
while true {
fn main() {
let p: port<msg> = port();
+ let ch = chan(p);
let recv_reader: port<chan<[u8]>> = port();
- let pack = task::spawn((chan(recv_reader), chan(p)), packager);
+ 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 prod = task::spawn(source_chan, producer);
+ let prod = task::spawn {|| producer(source_chan); };
while true {
let msg = recv(p);
import comm::*;
import task::*;
-fn a(&&_args: ()) {
+fn a() {
fn doit() {
fn b(c: chan<chan<int>>) {
let p = port();
send(c, chan(p));
}
let p = port();
- spawn(chan(p), b);
+ let ch = chan(p);
+ spawn {|| b(ch); };
recv(p);
}
let i = 0;
}
fn main() {
- let t = spawn_joinable((), a);
+ let t = spawn_joinable {|| a(); };
join(t);
}
fn main() {
let p: port<[u8]> = port();
- let prod = task::spawn(chan(p), producer);
+ let ch = chan(p);
+ let prod = task::spawn {|| producer(ch); };
let data: [u8] = recv(p);
}
import task::*;
fn main() {
- let other = spawn_joinable((), child);
+ let other = spawn_joinable {|| child(); };
#error("1");
yield();
join(other);
#error("3");
}
-fn child(&&_i: ()) { #error("2"); }
+fn child() { #error("2"); }
fn main() {
let p = port();
+ let ch = chan(p);
let y: int;
- task::spawn(chan(p), child);
+ task::spawn {|| child(ch); };
y = recv(p);
#debug("received 1");
log(debug, y);
assert (y == 10);
- task::spawn(chan(p), child);
+ task::spawn {|| child(ch); };
y = recv(p);
#debug("received 2");
log(debug, y);
import comm::port;
import comm::recv;
-fn child(&&_i: ()) { assert (1 == 2); }
+fn child() { assert (1 == 2); }
-fn parent(&&_i: ()) {
+fn parent() {
// Since this task isn't supervised it won't bring down the whole
// process
task::unsupervise();
let p = port::<int>();
- task::spawn((), child);
+ task::spawn {|| child(); };
let x = recv(p);
}
fn main() {
- task::spawn((), parent);
+ task::spawn {|| parent(); };
}
\ No newline at end of file
import comm;
import uint;
-fn die(&&_i: ()) {
+fn die() {
fail;
}
-fn iloop(&&_i: ()) {
+fn iloop() {
task::unsupervise();
- task::spawn((), die);
+ task::spawn {|| die(); };
}
fn main() {
uint::range(0u, 100u) {|_i|
- task::spawn((), iloop);
+ task::spawn {|| iloop(); };
}
}
\ No newline at end of file
import task;
import comm;
-fn sub(&&args: (comm::chan<int>, int)) {
- let (parent, id) = args;
+fn sub(parent: comm::chan<int>, id: int) {
if id == 0 {
comm::send(parent, 0);
} else {
let p = comm::port();
- let child = task::spawn((comm::chan(p), id - 1), sub);
+ let ch = comm::chan(p);
+ let child = task::spawn {|| sub(ch, id - 1); };
let y = comm::recv(p);
comm::send(parent, y + 1);
}
fn main() {
let p = comm::port();
- let child = task::spawn((comm::chan(p), 200), sub);
+ let ch = comm::chan(p);
+ let child = task::spawn {|| sub(ch, 200); };
let y = comm::recv(p);
#debug("transmission complete");
log(debug, y);
let sz = 400u;
while sz < 500u {
rustrt::set_min_stack(sz);
- task::join(task::spawn_joinable(200, getbig));
+ task::join(task::spawn_joinable {|| getbig(200) });
sz += 1u;
}
}
\ No newline at end of file
fn calllink09() { rustrt::sched_threads(); }
fn calllink10() { rustrt::rust_get_task(); }
-fn runtest(&&args:(fn(), u32)) {
- let (f, frame_backoff) = args;
+fn runtest(f: sendfn(), frame_backoff: u32) {
runtest2(f, frame_backoff, 0 as *u8);
}
-fn runtest2(f: fn(), frame_backoff: u32, last_stk: *u8) -> u32 {
+fn runtest2(f: sendfn(), frame_backoff: u32, last_stk: *u8) -> u32 {
let curr_stk = rustrt::debug_get_stk_seg();
if (last_stk != curr_stk && last_stk != 0 as *u8) {
// We switched stacks, go back and try to hit the dynamic linker
let sz = rng.next() % 256u32 + 256u32;
let frame_backoff = rng.next() % 10u32 + 1u32;
rustrt::set_min_stack(sz as uint);
- task::join(task::spawn_joinable((f, frame_backoff), runtest));
+ task::join(task::spawn_joinable {|| runtest(f, frame_backoff);});
}
}
\ No newline at end of file
import comm;
import uint;
-fn die(&&_i: ()) {
+fn die() {
fail;
}
-fn iloop(&&_i: ()) {
+fn iloop() {
task::unsupervise();
- task::spawn((), die);
+ task::spawn {|| die(); };
let p = comm::port::<()>();
let c = comm::chan(p);
while true {
fn main() {
uint::range(0u, 16u) {|_i|
- task::spawn((), iloop);
+ task::spawn {|| iloop(); };
}
}
\ No newline at end of file
let arg = sendfn(a: A, b: B) -> pair<A,B> {
ret make_generic_record(a, b);
};
- task::spawn(arg, f);
+ task::spawn {|| f(arg); };
}
fn test05() {
log(error, *three + n); // will copy x into the closure
assert(*three == 3);
};
- task::spawn(fn_to_send, test05_start);
+ task::spawn(sendfn[move fn_to_send]() {
+ test05_start(fn_to_send);
+ });
}
import task::yield;
import task;
-fn x(&&args: (str, int)) {
- let (s, n) = args;
- log(debug, s); log(debug, n);
+fn x(s: str, n: int) {
+ log(debug, s);
+ log(debug, n);
}
fn main() {
- 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);
+ task::spawn {|| x("hello from first spawned fn", 65); };
+ task::spawn {|| x("hello from second spawned fn", 66); };
+ task::spawn {|| x("hello from third spawned fn", 67); };
let i: int = 30;
while i > 0 { i = i - 1; #debug("parent sleeping"); yield(); }
}
import task::join;
import task::spawn_joinable;
-fn main() { let x = spawn_joinable(10, m::child); join(x); }
+fn main() { let x = spawn_joinable {|| m::child(10); }; join(x); }
mod m {
fn child(&&i: int) { log(debug, i); }
type ctx = comm::chan<int>;
-fn iotask(&&args: (ctx, str)) {
- let (cx, ip) = args;
+fn iotask(cx: ctx, ip: str) {
assert (str::eq(ip, "localhost"));
}
fn main() {
let p = comm::port::<int>();
- task::spawn((comm::chan(p), "localhost"), iotask);
+ let ch = comm::chan(p);
+ task::spawn {|| iotask(ch, "localhost"); };
}
import task;
-fn main() { let t = task::spawn_joinable(10, child); task::join(t); }
+fn main() {
+ let t = task::spawn_joinable {|| child(10); };
+ task::join(t);
+}
fn child(&&i: int) { log(error, i); assert (i == 10); }
use std;
import task::spawn;
-fn main() { spawn((10, 20, 30, 40, 50, 60, 70, 80, 90), child); }
+fn main() { spawn {|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)); }; }
fn child(&&args: (int, int, int, int, int, int, int, int, int)) {
let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args;
fn test05() {
let po = comm::port();
let ch = comm::chan(po);
- task::spawn(ch, test05_start);
+ task::spawn {|| test05_start(ch); };
let value = comm::recv(po);
log(error, value);
value = comm::recv(po);
fn main() { test00(); }
-fn start(&&_i: ()) { #debug("Started / Finished task."); }
+fn start() { #debug("Started / Finished task."); }
fn test00() {
- let t = spawn_joinable((), start);
+ let t = spawn_joinable {|| start(); };
join(t);
#debug("Completing.");
}
fn main() {
let p = comm::port();
- let child = task::spawn(comm::chan(p), start);
+ let ch = comm::chan(p);
+ let child = task::spawn {|| start(ch); };
let c = comm::recv(p);
comm::send(c, "A");
fn main() {
let p = comm::port();
- let child = task::spawn(comm::chan(p), start);
+ let ch = comm::chan(p);
+ let child = task::spawn {|| start(ch); };
let c = comm::recv(p);
}
fn test00() {
let i: int = 0;
- let t = task::spawn_joinable(i, start);
+ let t = task::spawn_joinable {|| start(i); };
// Sleep long enough for the task to finish.
task::sleep(10000u);
import comm;
import comm::send;
-fn start(&&args: (comm::chan<int>, int, int)) {
- let (c, start, number_of_messages) = args;
+fn start(c: comm::chan<int>, start: int, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { send(c, start + i); i += 1; }
}
fn main() {
#debug("Check that we don't deadlock.");
let p = comm::port::<int>();
- let a = task::spawn_joinable((comm::chan(p), 0, 10), start);
+ let ch = comm::chan(p);
+ let a = task::spawn_joinable {|| start(ch, 0, 10); };
task::join(a);
#debug("Joined task");
}
fn main() {
let po = comm::port::<int>();
+ let ch = comm::chan(po);
// Spawn 10 tasks each sending us back one int.
let i = 10;
while (i > 0) {
log(debug, i);
- task::spawn((i, comm::chan(po)), child);
+ task::spawn {|| child(i, ch); };
i = i - 1;
}
#debug("main thread exiting");
}
-fn child(&&args: (int, comm::chan<int>)) {
- let (x, ch) = args;
+fn child(x: int, ch: comm::chan<int>) {
log(debug, x);
- comm::send(ch, x);
+ comm::send(ch, copy x);
}
import comm;
import task;
-fn start(&&args: (comm::chan<int>, int)) {
- let (c, i) = args;
-
- while i > 0 { comm::send(c, 0); i = i - 1; }
+fn start(c: comm::chan<int>, i0: int) {
+ let i = i0;
+ while i > 0 {
+ comm::send(c, 0);
+ i = i - 1;
+ }
}
fn main() {
// is likely to terminate before the child completes, so from
// the child's point of view the receiver may die. We should
// drop messages on the floor in this case, and not crash!
- let child = task::spawn((comm::chan(p), 10), start);
+ let ch = comm::chan(p);
+ let child = task::spawn {|| start(ch, 10); };
let c = comm::recv(p);
}
let tasks = [];
while i < number_of_tasks {
i = i + 1;
- tasks += [task::spawn_joinable(copy i, start)];
+ tasks += [task::spawn_joinable {|| start(i); }];
}
for t in tasks { task::join(t); }
fn main() { #debug("===== WITHOUT THREADS ====="); test00(); }
-fn test00_start(&&args: (chan<int>, int, int)) {
- let (ch, message, count) = args;
+fn test00_start(ch: chan<int>, message: int, count: int) {
#debug("Starting test00_start");
let i: int = 0;
while i < count {
// Create and spawn tasks...
let tasks = [];
while i < number_of_tasks {
- tasks += [task::spawn_joinable(
- (ch, i, number_of_messages), test00_start)];
+ tasks += [task::spawn_joinable {||
+ test00_start(ch, i, number_of_messages)
+ }];
i = i + 1;
}
fn main() { test00(); }
-fn test00_start(&&args: (comm::chan<int>, int, int)) {
- let (c, start, number_of_messages) = args;
+fn test00_start(c: comm::chan<int>, start: int, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { comm::send(c, start + i); i += 1; }
}
let sum: int = 0;
let p = port();
let number_of_messages: int = 10;
+ let c = chan(p);
- let t0 =
- task::spawn_joinable((chan(p),
- number_of_messages * 0,
- number_of_messages), test00_start);
- let t1 =
- task::spawn_joinable((chan(p),
- number_of_messages * 1,
- number_of_messages), test00_start);
- let t2 =
- task::spawn_joinable((chan(p),
- number_of_messages * 2,
- number_of_messages), test00_start);
- let t3 =
- task::spawn_joinable((chan(p),
- number_of_messages * 3,
- number_of_messages), test00_start);
+ let t0 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 0, number_of_messages);
+ };
+ let t1 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 1, number_of_messages);
+ };
+ let t2 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 2, number_of_messages);
+ };
+ let t3 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 3, number_of_messages);
+ };
let i: int = 0;
while i < number_of_messages {
fn main() { test00(); }
-fn test00_start(&&args: (comm::chan<int>, int, int)) {
- let (c, start, number_of_messages) = args;
+fn test00_start(c: comm::chan<int>, start: int, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { comm::send(c, start + i); i += 1; }
}
let r: int = 0;
let sum: int = 0;
let p = comm::port();
+ let c = comm::chan(p);
let number_of_messages: int = 10;
- let t0 =
- task::spawn_joinable((comm::chan(p),
- number_of_messages * 0,
- number_of_messages), test00_start);
- let t1 =
- task::spawn_joinable((comm::chan(p),
- number_of_messages * 1,
- number_of_messages), test00_start);
- let t2 =
- task::spawn_joinable((comm::chan(p),
- number_of_messages * 2,
- number_of_messages), test00_start);
- let t3 =
- task::spawn_joinable((comm::chan(p),
- number_of_messages * 3,
- number_of_messages), test00_start);
+ let t0 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 0, number_of_messages);
+ };
+ let t1 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 1, number_of_messages);
+ };
+ let t2 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 2, number_of_messages);
+ };
+ let t3 = task::spawn_joinable {||
+ test00_start(c, number_of_messages * 3, number_of_messages);
+ };
let i: int = 0;
while i < number_of_messages {
fn main() { test00(); }
-fn test00_start(&&args: (comm::chan<int>, int)) {
- let (c, number_of_messages) = args;
+fn test00_start(c: comm::chan<int>, number_of_messages: int) {
let i: int = 0;
while i < number_of_messages { comm::send(c, i + 0); i += 1; }
}
let sum: int = 0;
let p = comm::port();
let number_of_messages: int = 10;
+ let ch = comm::chan(p);
- let t0 = task::spawn_joinable((comm::chan(p), number_of_messages),
- test00_start);
+ let t0 = task::spawn_joinable {||
+ test00_start(ch, number_of_messages);
+ };
let i: int = 0;
while i < number_of_messages {
}
}
-fn starbase(&&_args: ()) {
+fn starbase() {
int::range(0, 10) { |_i|
let p = comm::port();
- task::spawn(comm::chan(p), starship);
+ let c = comm::chan(p);
+ task::spawn {|| starship(c);};
task::yield();
}
}
fn main() {
int::range(0, 10) { |_i|
- task::spawn((), starbase);
+ task::spawn {|| starbase();};
}
}
\ No newline at end of file
test06();
}
-fn test00_start(&&args: (chan<int>, int, int)) {
- let (ch, message, count) = args;
+fn test00_start(ch: chan<int>, message: int, count: int) {
#debug("Starting test00_start");
let i: int = 0;
while i < count {
let tasks = [];
while i < number_of_tasks {
i = i + 1;
- tasks += [task::spawn_joinable(
- (ch, i, number_of_messages), test00_start)];
+ tasks += [
+ task::spawn_joinable {|| test00_start(ch, i, number_of_messages);}
+ ];
}
let sum: int = 0;
for t in tasks {
log(debug, v.length());
}
-fn test04_start(&&_args: ()) {
+fn test04_start() {
#debug("Started task");
let i: int = 1024 * 1024;
while i > 0 { i = i - 1; }
fn test04() {
#debug("Spawning lots of tasks.");
let i: int = 4;
- while i > 0 { i = i - 1; task::spawn((), test04_start); }
+ while i > 0 { i = i - 1; task::spawn {|| test04_start(); }; }
#debug("Finishing up.");
}
fn test05() {
let po = comm::port();
let ch = chan(po);
- task::spawn(ch, test05_start);
+ task::spawn {|| test05_start(ch); };
let value: int;
value = recv(po);
value = recv(po);
let tasks = [];
while i < number_of_tasks {
i = i + 1;
- tasks += [task::spawn_joinable(copy i, test06_start)];
+ tasks += [task::spawn_joinable {|| test06_start(i);}];
}
use std;
import task;
-fn supervised(&&_args: ()) {
+fn supervised() {
// Yield to make sure the supervisor joins before we
// fail. This is currently not needed because the supervisor
// runs first, but I can imagine that changing.
fail;
}
-fn supervisor(&&_args: ()) {
+fn supervisor() {
// Unsupervise this task so the process doesn't return a failure status as
// a result of the main task being killed.
task::unsupervise();
let f = supervised;
- let t = task::spawn_joinable((), supervised);
+ let t = task::spawn_joinable {|| supervised(); };
task::join(t);
}
fn main() {
- let dom2 = task::spawn_joinable((), supervisor);
+ let dom2 = task::spawn_joinable {|| supervisor(); };
task::join(dom2);
}
use std;
import task;
-fn main() { task::spawn("Hello", child); }
+fn main() {
+ task::spawn {|| child("Hello"); };
+}
fn child(&&s: str) {
fn test_ret() { let x: @int = ret; }
fn test_fail() {
- fn f(&&_i: ()) { task::unsupervise(); let x: @int = fail; }
- task::spawn((), f);
+ fn f() { task::unsupervise(); let x: @int = fail; }
+ task::spawn {|| f(); };
}
fn test_fail_indirect() {
fn f() -> ! { fail; }
- fn g(&&_i: ()) { task::unsupervise(); let x: @int = f(); }
- task::spawn((), g);
+ fn g() { task::unsupervise(); let x: @int = f(); }
+ task::spawn {|| g(); };
}
fn main() {
fn main() {
let i = 10;
- while i > 0 { task::spawn(copy i, child); i = i - 1; }
+ while i > 0 { task::spawn {|| child(i); }; i = i - 1; }
#debug("main thread exiting");
}
import task;
import uint;
-fn child(args: (comm::chan<~uint>, uint)) {
- let (c, i) = args;
+fn child(c: comm::chan<~uint>, i: uint) {
comm::send(c, ~i);
}
fn main() {
let p = comm::port();
+ let ch = comm::chan(p);
let n = 100u;
let expected = 0u;
uint::range(0u, n) {|i|
- task::spawn((comm::chan(p), i), child);
+ task::spawn {|| child(ch, i); };
expected += i;
}
use std;
import task;
-fn f(&&_i: ()) {
+fn f() {
task::unsupervise();
let a = @0;
fail;
}
fn main() {
- task::spawn((), f);
+ task::spawn {|| f(); };
}
\ No newline at end of file
fn main() {
let p = comm::port();
let c = comm::chan(p);
- task::spawn(c, f);
+ task::spawn {|| f(c); };
assert comm::recv(p);
}
\ No newline at end of file
resource complainer(c: @int) {
}
-fn f(&&_i: ()) {
+fn f() {
task::unsupervise();
let c <- complainer(@0);
fail;
}
fn main() {
- task::spawn((), f);
+ task::spawn {|| f(); };
}
\ No newline at end of file
use std;
import task;
-fn f(&&_i: ()) {
+fn f() {
task::unsupervise();
let a = ~0;
fail;
}
fn main() {
- task::spawn((), f);
+ task::spawn {|| f(); };
}
\ No newline at end of file
import task::*;
fn main() {
- let other = task::spawn_joinable((), child);
+ let other = task::spawn_joinable {|| child(); };
#error("1");
yield();
#error("2");
join(other);
}
-fn child(&&_i: ()) {
+fn child() {
#error("4"); yield(); #error("5"); yield(); #error("6");
}
import task::*;
fn main() {
- let other = task::spawn_joinable((), child);
+ let other = task::spawn_joinable {|| child(); };
#error("1");
yield();
join(other);
}
-fn child(&&_i: ()) { #error("2"); }
+fn child() { #error("2"); }
#[ignore(cfg(target_os = "win32"))]
fn test_unsupervise() {
fn f() { task::unsupervise(); fail; }
- task::spawn {|| f};
+ task::spawn {|| f();};
}
#[test]
fn test_lib_spawn() {
fn foo() { #error("Hello, World!"); }
- task::spawn {|| foo};
+ task::spawn {|| foo();};
}
#[test]
#[test]
fn spawn_polymorphic() {
fn foo<send T>(x: T) { log(error, x); }
- task::spawn {|| foo(true);}
- task::spawn {|| foo(42);}
+ task::spawn {|| foo(true);};
+ task::spawn {|| foo(42);};
}
fn init_empty() {
let r = task::join(
- task::spawn_joinable((), fn (&&_i: ()) {
+ task::spawn_joinable {||
task::unsupervise();
vec::init::<int>([]);
- }));
+ });
assert r == task::tr_failure
}