tests/tutorials: Get rid of move.
This commit is contained in:
parent
e244f103c9
commit
178882c98f
150 changed files with 409 additions and 411 deletions
|
|
@ -27,7 +27,7 @@ fn collect_dvec(num: uint) -> ~[uint] {
|
|||
for uint::range(0u, num) |i| {
|
||||
result.push(i);
|
||||
}
|
||||
return dvec::unwrap(move result);
|
||||
return dvec::unwrap(result);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ fn bfs(graph: graph, key: node_id) -> bfs_result {
|
|||
};
|
||||
}
|
||||
|
||||
move marks
|
||||
marks
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -260,7 +260,7 @@ fn pbfs(&&graph: arc::ARC<graph>, key: node_id) -> bfs_result {
|
|||
i += 1;
|
||||
let old_len = colors.len();
|
||||
|
||||
let color = arc::ARC(move colors);
|
||||
let color = arc::ARC(colors);
|
||||
|
||||
let color_vec = arc::get(&color); // FIXME #3387 requires this temp
|
||||
colors = do par::mapi(*color_vec) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use io::WriterUtil;
|
|||
use pipes::{Port, Chan, SharedChan};
|
||||
|
||||
macro_rules! move_out (
|
||||
{ $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
|
||||
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
|
||||
)
|
||||
|
||||
enum request {
|
||||
|
|
@ -58,7 +58,7 @@ fn run(args: &[~str]) {
|
|||
let (from_child, to_parent) = pipes::stream();
|
||||
let (from_parent, to_child) = pipes::stream();
|
||||
|
||||
let to_child = SharedChan(move to_child);
|
||||
let to_child = SharedChan(to_child);
|
||||
|
||||
let size = uint::from_str(args[1]).get();
|
||||
let workers = uint::from_str(args[2]).get();
|
||||
|
|
@ -68,8 +68,8 @@ fn run(args: &[~str]) {
|
|||
for uint::range(0, workers) |_i| {
|
||||
let to_child = to_child.clone();
|
||||
do task::task().future_result(|+r| {
|
||||
worker_results.push(move r);
|
||||
}).spawn |move to_child| {
|
||||
worker_results.push(r);
|
||||
}).spawn || {
|
||||
for uint::range(0, size / workers) |_i| {
|
||||
//error!("worker %?: sending %? bytes", i, num_bytes);
|
||||
to_child.send(bytes(num_bytes));
|
||||
|
|
@ -77,7 +77,7 @@ fn run(args: &[~str]) {
|
|||
//error!("worker %? exiting", i);
|
||||
};
|
||||
}
|
||||
do task::spawn |move from_parent, move to_parent| {
|
||||
do task::spawn || {
|
||||
server(from_parent, to_parent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ use io::WriterUtil;
|
|||
use pipes::{Port, PortSet, Chan};
|
||||
|
||||
macro_rules! move_out (
|
||||
{ $x:expr } => { unsafe { let y = move *ptr::addr_of(&($x)); move y } }
|
||||
{ $x:expr } => { unsafe { let y = *ptr::addr_of(&($x)); y } }
|
||||
)
|
||||
|
||||
enum request {
|
||||
|
|
@ -54,7 +54,7 @@ fn run(args: &[~str]) {
|
|||
let (from_child, to_parent) = pipes::stream();
|
||||
let (from_parent_, to_child) = pipes::stream();
|
||||
let from_parent = PortSet();
|
||||
from_parent.add(move from_parent_);
|
||||
from_parent.add(from_parent_);
|
||||
|
||||
let size = uint::from_str(args[1]).get();
|
||||
let workers = uint::from_str(args[2]).get();
|
||||
|
|
@ -63,10 +63,10 @@ fn run(args: &[~str]) {
|
|||
let mut worker_results = ~[];
|
||||
for uint::range(0, workers) |_i| {
|
||||
let (from_parent_, to_child) = pipes::stream();
|
||||
from_parent.add(move from_parent_);
|
||||
from_parent.add(from_parent_);
|
||||
do task::task().future_result(|+r| {
|
||||
worker_results.push(move r);
|
||||
}).spawn |move to_child| {
|
||||
worker_results.push(r);
|
||||
}).spawn || {
|
||||
for uint::range(0, size / workers) |_i| {
|
||||
//error!("worker %?: sending %? bytes", i, num_bytes);
|
||||
to_child.send(bytes(num_bytes));
|
||||
|
|
@ -74,7 +74,7 @@ fn run(args: &[~str]) {
|
|||
//error!("worker %? exiting", i);
|
||||
};
|
||||
}
|
||||
do task::spawn |move from_parent, move to_parent| {
|
||||
do task::spawn || {
|
||||
server(from_parent, to_parent);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint {
|
|||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let m = arc::MutexARC(~[]);
|
||||
((&m).clone(), move m)
|
||||
((&m).clone(), m)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -48,18 +48,18 @@ fn thread_ring(i: uint,
|
|||
count: uint,
|
||||
+num_chan: pipe,
|
||||
+num_port: pipe) {
|
||||
let mut num_chan = move Some(move num_chan);
|
||||
let mut num_port = move Some(move num_port);
|
||||
let mut num_chan = Some(num_chan);
|
||||
let mut num_port = Some(num_port);
|
||||
// Send/Receive lots of messages.
|
||||
for uint::range(0u, count) |j| {
|
||||
//error!("task %?, iter %?", i, j);
|
||||
let mut num_chan2 = option::swap_unwrap(&mut num_chan);
|
||||
let mut num_port2 = option::swap_unwrap(&mut num_port);
|
||||
send(&num_chan2, i * j);
|
||||
num_chan = Some(move num_chan2);
|
||||
num_chan = Some(num_chan2);
|
||||
let _n = recv(&num_port2);
|
||||
//log(error, _n);
|
||||
num_port = Some(move num_port2);
|
||||
num_port = Some(num_port2);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ fn main() {
|
|||
let msg_per_task = uint::from_str(args[2]).get();
|
||||
|
||||
let (num_chan, num_port) = init();
|
||||
let mut num_chan = Some(move num_chan);
|
||||
let mut num_chan = Some(num_chan);
|
||||
|
||||
let start = time::precise_time_s();
|
||||
|
||||
|
|
@ -89,22 +89,22 @@ fn main() {
|
|||
let (new_chan, num_port) = init();
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
let num_port = ~mut Some(move num_port);
|
||||
let new_future = future::spawn(|move num_chan2, move num_port| {
|
||||
let num_port = ~mut Some(num_port);
|
||||
let new_future = do future::spawn() || {
|
||||
let mut num_chan = None;
|
||||
num_chan <-> *num_chan2;
|
||||
let mut num_port1 = None;
|
||||
num_port1 <-> *num_port;
|
||||
thread_ring(i, msg_per_task,
|
||||
option::unwrap(move num_chan),
|
||||
option::unwrap(move num_port1))
|
||||
});
|
||||
futures.push(move new_future);
|
||||
num_chan = Some(move new_chan);
|
||||
option::unwrap(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
};
|
||||
|
||||
// do our iteration
|
||||
thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
|
||||
thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
|
||||
|
||||
// synchronize
|
||||
for futures.each |f| { f.get() };
|
||||
|
|
|
|||
|
|
@ -29,15 +29,15 @@ proto! ring (
|
|||
)
|
||||
|
||||
macro_rules! move_out (
|
||||
($x:expr) => { unsafe { let y = move *ptr::addr_of(&$x); move y } }
|
||||
($x:expr) => { unsafe { let y = *ptr::addr_of(&$x); y } }
|
||||
)
|
||||
|
||||
fn thread_ring(i: uint,
|
||||
count: uint,
|
||||
+num_chan: ring::client::num,
|
||||
+num_port: ring::server::num) {
|
||||
let mut num_chan = move Some(move num_chan);
|
||||
let mut num_port = move Some(move num_port);
|
||||
let mut num_chan = Some(num_chan);
|
||||
let mut num_port = Some(num_port);
|
||||
// Send/Receive lots of messages.
|
||||
for uint::range(0, count) |j| {
|
||||
//error!("task %?, iter %?", i, j);
|
||||
|
|
@ -45,9 +45,9 @@ fn thread_ring(i: uint,
|
|||
let mut num_port2 = None;
|
||||
num_chan2 <-> num_chan;
|
||||
num_port2 <-> num_port;
|
||||
num_chan = Some(ring::client::num(option::unwrap(move num_chan2), i * j));
|
||||
let port = option::unwrap(move num_port2);
|
||||
match recv(move port) {
|
||||
num_chan = Some(ring::client::num(option::unwrap(num_chan2), i * j));
|
||||
let port = option::unwrap(num_port2);
|
||||
match recv(port) {
|
||||
ring::num(_n, p) => {
|
||||
//log(error, _n);
|
||||
num_port = Some(move_out!(p));
|
||||
|
|
@ -70,7 +70,7 @@ fn main() {
|
|||
let msg_per_task = uint::from_str(args[2]).get();
|
||||
|
||||
let (num_chan, num_port) = ring::init();
|
||||
let mut num_chan = Some(move num_chan);
|
||||
let mut num_chan = Some(num_chan);
|
||||
|
||||
let start = time::precise_time_s();
|
||||
|
||||
|
|
@ -82,23 +82,22 @@ fn main() {
|
|||
let (new_chan, num_port) = ring::init();
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
let num_port = ~mut Some(move num_port);
|
||||
let new_future = do future::spawn
|
||||
|move num_chan2, move num_port| {
|
||||
let num_port = ~mut Some(num_port);
|
||||
let new_future = do future::spawn || {
|
||||
let mut num_chan = None;
|
||||
num_chan <-> *num_chan2;
|
||||
let mut num_port1 = None;
|
||||
num_port1 <-> *num_port;
|
||||
thread_ring(i, msg_per_task,
|
||||
option::unwrap(move num_chan),
|
||||
option::unwrap(move num_port1))
|
||||
option::unwrap(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(move new_future);
|
||||
num_chan = Some(move new_chan);
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
};
|
||||
|
||||
// do our iteration
|
||||
thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
|
||||
thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
|
||||
|
||||
// synchronize
|
||||
for futures.each |f| { f.get() };
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ fn recv(p: &pipe) -> uint {
|
|||
|
||||
fn init() -> (pipe,pipe) {
|
||||
let x = arc::RWARC(~[]);
|
||||
((&x).clone(), move x)
|
||||
((&x).clone(), x)
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -48,18 +48,18 @@ fn thread_ring(i: uint,
|
|||
count: uint,
|
||||
+num_chan: pipe,
|
||||
+num_port: pipe) {
|
||||
let mut num_chan = move Some(move num_chan);
|
||||
let mut num_port = move Some(move num_port);
|
||||
let mut num_chan = Some(num_chan);
|
||||
let mut num_port = Some(num_port);
|
||||
// Send/Receive lots of messages.
|
||||
for uint::range(0u, count) |j| {
|
||||
//error!("task %?, iter %?", i, j);
|
||||
let mut num_chan2 = option::swap_unwrap(&mut num_chan);
|
||||
let mut num_port2 = option::swap_unwrap(&mut num_port);
|
||||
send(&num_chan2, i * j);
|
||||
num_chan = Some(move num_chan2);
|
||||
num_chan = Some(num_chan2);
|
||||
let _n = recv(&num_port2);
|
||||
//log(error, _n);
|
||||
num_port = Some(move num_port2);
|
||||
num_port = Some(num_port2);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -77,7 +77,7 @@ fn main() {
|
|||
let msg_per_task = uint::from_str(args[2]).get();
|
||||
|
||||
let (num_chan, num_port) = init();
|
||||
let mut num_chan = Some(move num_chan);
|
||||
let mut num_chan = Some(num_chan);
|
||||
|
||||
let start = time::precise_time_s();
|
||||
|
||||
|
|
@ -89,23 +89,22 @@ fn main() {
|
|||
let (new_chan, num_port) = init();
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
let num_port = ~mut Some(move num_port);
|
||||
let new_future = do future::spawn
|
||||
|move num_chan2, move num_port| {
|
||||
let num_port = ~mut Some(num_port);
|
||||
let new_future = do future::spawn || {
|
||||
let mut num_chan = None;
|
||||
num_chan <-> *num_chan2;
|
||||
let mut num_port1 = None;
|
||||
num_port1 <-> *num_port;
|
||||
thread_ring(i, msg_per_task,
|
||||
option::unwrap(move num_chan),
|
||||
option::unwrap(move num_port1))
|
||||
option::unwrap(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(move new_future);
|
||||
num_chan = Some(move new_chan);
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
};
|
||||
|
||||
// do our iteration
|
||||
thread_ring(0, msg_per_task, option::unwrap(move num_chan), move num_port);
|
||||
thread_ring(0, msg_per_task, option::unwrap(num_chan), num_port);
|
||||
|
||||
// synchronize
|
||||
for futures.each |f| { f.get() };
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ fn Noise2DContext() -> ~Noise2DContext {
|
|||
r.shuffle_mut(permutations);
|
||||
|
||||
~Noise2DContext{
|
||||
rgradients: move rgradients,
|
||||
permutations: move permutations,
|
||||
rgradients: rgradients,
|
||||
permutations: permutations,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,17 +45,17 @@ proto! pingpong_unbounded (
|
|||
|
||||
// This stuff should go in libcore::pipes
|
||||
macro_rules! move_it (
|
||||
{ $x:expr } => { let t = move *ptr::addr_of(&($x)); move t }
|
||||
{ $x:expr } => { let t = *ptr::addr_of(&($x)); t }
|
||||
)
|
||||
|
||||
macro_rules! follow (
|
||||
{
|
||||
$($message:path($($x: ident),+) -> $next:ident $e:expr)+
|
||||
} => (
|
||||
|m| match move m {
|
||||
$(Some($message($($x,)* move next)) => {
|
||||
let $next = move next;
|
||||
move $e })+
|
||||
|m| match m {
|
||||
$(Some($message($($x,)* next)) => {
|
||||
let $next = next;
|
||||
$e })+
|
||||
_ => { fail!() }
|
||||
}
|
||||
);
|
||||
|
|
@ -63,10 +63,10 @@ macro_rules! follow (
|
|||
{
|
||||
$($message:path -> $next:ident $e:expr)+
|
||||
} => (
|
||||
|m| match move m {
|
||||
$(Some($message(move next)) => {
|
||||
let $next = move next;
|
||||
move $e })+
|
||||
|m| match m {
|
||||
$(Some($message(next)) => {
|
||||
let $next = next;
|
||||
$e })+
|
||||
_ => { fail!() }
|
||||
}
|
||||
)
|
||||
|
|
@ -74,7 +74,7 @@ macro_rules! follow (
|
|||
|
||||
fn switch<T: Owned, Tb: Owned, U>(+endp: pipes::RecvPacketBuffered<T, Tb>,
|
||||
f: fn(+v: Option<T>) -> U) -> U {
|
||||
f(pipes::try_recv(move endp))
|
||||
f(pipes::try_recv(endp))
|
||||
}
|
||||
|
||||
// Here's the benchmark
|
||||
|
|
@ -84,10 +84,10 @@ fn bounded(count: uint) {
|
|||
|
||||
let mut ch = do spawn_service(init) |ch| {
|
||||
let mut count = count;
|
||||
let mut ch = move ch;
|
||||
let mut ch = ch;
|
||||
while count > 0 {
|
||||
ch = switch(move ch, follow! (
|
||||
ping -> next { server::pong(move next) }
|
||||
ch = switch(ch, follow! (
|
||||
ping -> next { server::pong(next) }
|
||||
));
|
||||
|
||||
count -= 1;
|
||||
|
|
@ -96,10 +96,10 @@ fn bounded(count: uint) {
|
|||
|
||||
let mut count = count;
|
||||
while count > 0 {
|
||||
let ch_ = client::ping(move ch);
|
||||
let ch_ = client::ping(ch);
|
||||
|
||||
ch = switch(move ch_, follow! (
|
||||
pong -> next { move next }
|
||||
ch = switch(ch_, follow! (
|
||||
pong -> next { next }
|
||||
));
|
||||
|
||||
count -= 1;
|
||||
|
|
@ -111,10 +111,10 @@ fn unbounded(count: uint) {
|
|||
|
||||
let mut ch = do spawn_service(init) |ch| {
|
||||
let mut count = count;
|
||||
let mut ch = move ch;
|
||||
let mut ch = ch;
|
||||
while count > 0 {
|
||||
ch = switch(move ch, follow! (
|
||||
ping -> next { server::pong(move next) }
|
||||
ch = switch(ch, follow! (
|
||||
ping -> next { server::pong(next) }
|
||||
));
|
||||
|
||||
count -= 1;
|
||||
|
|
@ -123,10 +123,10 @@ fn unbounded(count: uint) {
|
|||
|
||||
let mut count = count;
|
||||
while count > 0 {
|
||||
let ch_ = client::ping(move ch);
|
||||
let ch_ = client::ping(ch);
|
||||
|
||||
ch = switch(move ch_, follow! (
|
||||
pong -> next { move next }
|
||||
ch = switch(ch_, follow! (
|
||||
pong -> next { next }
|
||||
));
|
||||
|
||||
count -= 1;
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ fn rendezvous(nn: uint, set: ~[color]) {
|
|||
let to_rendezvous_log = to_rendezvous_log.clone();
|
||||
let (from_rendezvous, to_creature) = stream();
|
||||
let from_rendezvous = Cell(from_rendezvous);
|
||||
do task::spawn |move ii, move col| {
|
||||
do task::spawn || {
|
||||
creature(ii, col, from_rendezvous.take(), to_rendezvous.clone(),
|
||||
to_rendezvous_log.clone());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ fn make_sequence_processor(sz: uint, from_parent: pipes::Port<~[u8]>,
|
|||
_ => { ~"" }
|
||||
};
|
||||
|
||||
to_parent.send(move buffer);
|
||||
to_parent.send(buffer);
|
||||
}
|
||||
|
||||
// given a FASTA file on stdin, process sequence THREE
|
||||
|
|
@ -149,23 +149,23 @@ fn main() {
|
|||
// initialize each sequence sorter
|
||||
let sizes = ~[1,2,3,4,6,12,18];
|
||||
let streams = vec::map(sizes, |_sz| Some(stream()));
|
||||
let mut streams = move streams;
|
||||
let mut streams = streams;
|
||||
let mut from_child = ~[];
|
||||
let to_child = vec::mapi(sizes, |ii, sz| {
|
||||
let sz = *sz;
|
||||
let mut stream = None;
|
||||
stream <-> streams[ii];
|
||||
let (from_child_, to_parent_) = option::unwrap(move stream);
|
||||
let (from_child_, to_parent_) = option::unwrap(stream);
|
||||
|
||||
from_child.push(move from_child_);
|
||||
from_child.push(from_child_);
|
||||
|
||||
let (from_parent, to_child) = pipes::stream();
|
||||
|
||||
do task::spawn_with(move from_parent) |move to_parent_, from_parent| {
|
||||
do task::spawn_with(from_parent) |from_parent| {
|
||||
make_sequence_processor(sz, from_parent, to_parent_);
|
||||
};
|
||||
|
||||
move to_child
|
||||
to_child
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ fn main() {
|
|||
let pchan = pipes::SharedChan(pchan);
|
||||
for uint::range(0_u, size) |j| {
|
||||
let cchan = pchan.clone();
|
||||
do task::spawn |move cchan| { cchan.send(chanmb(j, size)) };
|
||||
do task::spawn || { cchan.send(chanmb(j, size)) };
|
||||
};
|
||||
writer(path, pport, size);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,15 +43,15 @@ fn fib(n: int) -> int {
|
|||
} else {
|
||||
let p = pipes::PortSet();
|
||||
let ch = p.chan();
|
||||
task::spawn(|move ch| pfib(ch, n - 1) );
|
||||
task::spawn(|| pfib(ch, n - 1) );
|
||||
let ch = p.chan();
|
||||
task::spawn(|move ch| pfib(ch, n - 2) );
|
||||
task::spawn(|| pfib(ch, n - 2) );
|
||||
c.send(p.recv() + p.recv());
|
||||
}
|
||||
}
|
||||
|
||||
let (p, ch) = pipes::stream();
|
||||
let _t = task::spawn(|move ch| pfib(ch, n) );
|
||||
let _t = task::spawn(|| pfib(ch, n) );
|
||||
p.recv()
|
||||
}
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ fn stress(num_tasks: int) {
|
|||
let mut results = ~[];
|
||||
for range(0, num_tasks) |i| {
|
||||
do task::task().future_result(|+r| {
|
||||
results.push(move r);
|
||||
results.push(r);
|
||||
}).spawn {
|
||||
stress_task(i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,6 +99,6 @@ fn recurse_or_fail(depth: int, st: Option<State>) {
|
|||
}
|
||||
};
|
||||
|
||||
recurse_or_fail(depth, Some(move st));
|
||||
recurse_or_fail(depth, Some(st));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,14 @@ fn child_generation(gens_left: uint, -c: pipes::Chan<()>) {
|
|||
// This used to be O(n^2) in the number of generations that ever existed.
|
||||
// With this code, only as many generations are alive at a time as tasks
|
||||
// alive at a time,
|
||||
let c = ~mut Some(move c);
|
||||
do task::spawn_supervised |move c| {
|
||||
let c = ~mut Some(c);
|
||||
do task::spawn_supervised || {
|
||||
let c = option::swap_unwrap(c);
|
||||
if gens_left & 1 == 1 {
|
||||
task::yield(); // shake things up a bit
|
||||
}
|
||||
if gens_left > 0 {
|
||||
child_generation(gens_left - 1, move c); // recurse
|
||||
child_generation(gens_left - 1, c); // recurse
|
||||
} else {
|
||||
c.send(())
|
||||
}
|
||||
|
|
@ -44,7 +44,7 @@ fn main() {
|
|||
};
|
||||
|
||||
let (p,c) = pipes::stream();
|
||||
child_generation(uint::from_str(args[1]).get(), move c);
|
||||
child_generation(uint::from_str(args[1]).get(), c);
|
||||
if p.try_recv().is_none() {
|
||||
fail!(~"it happened when we slumbered");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@ fn grandchild_group(num_tasks: uint) {
|
|||
|
||||
fn spawn_supervised_blocking(myname: &str, +f: fn~()) {
|
||||
let mut res = None;
|
||||
task::task().future_result(|+r| res = Some(move r)).supervised().spawn(move f);
|
||||
task::task().future_result(|+r| res = Some(r)).supervised().spawn(f);
|
||||
error!("%s group waiting", myname);
|
||||
let x = option::unwrap(move res).recv();
|
||||
let x = option::unwrap(res).recv();
|
||||
assert x == task::Success;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue