Revert "test: De-~mut the test suite. rs=demuting"
This reverts commit f63efdc210.
This commit is contained in:
parent
f63efdc210
commit
00d8db5b5d
21 changed files with 121 additions and 67 deletions
|
|
@ -87,12 +87,17 @@ fn main() {
|
|||
for uint::range(1u, num_tasks) |i| {
|
||||
//error!("spawning %?", i);
|
||||
let (new_chan, num_port) = init();
|
||||
let num_chan2 = Cell(num_chan);
|
||||
let num_port = Cell(num_port);
|
||||
let new_future = do future::spawn() {
|
||||
let num_chan = num_chan2.take();
|
||||
let num_port1 = num_port.take();
|
||||
thread_ring(i, msg_per_task, num_chan, num_port1)
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
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(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
|
|
|
|||
|
|
@ -17,12 +17,11 @@
|
|||
// This version uses automatically compiled channel contracts.
|
||||
|
||||
extern mod std;
|
||||
|
||||
use core::cell::Cell;
|
||||
use core::pipes::recv;
|
||||
use std::time;
|
||||
use std::future;
|
||||
|
||||
use core::pipes::recv;
|
||||
|
||||
proto! ring (
|
||||
num:send {
|
||||
num(uint) -> num
|
||||
|
|
@ -81,12 +80,17 @@ fn main() {
|
|||
for uint::range(1u, num_tasks) |i| {
|
||||
//error!("spawning %?", i);
|
||||
let (new_chan, num_port) = ring::init();
|
||||
let num_chan2 = Cell(num_chan);
|
||||
let num_port = Cell(num_port);
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
let num_port = ~mut Some(num_port);
|
||||
let new_future = do future::spawn || {
|
||||
let num_chan = num_chan2.take();
|
||||
let num_port1 = num_port.take();
|
||||
thread_ring(i, msg_per_task, num_chan, num_port1)
|
||||
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(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
|
|
|
|||
|
|
@ -87,12 +87,17 @@ fn main() {
|
|||
for uint::range(1u, num_tasks) |i| {
|
||||
//error!("spawning %?", i);
|
||||
let (new_chan, num_port) = init();
|
||||
let num_chan2 = Cell(num_chan);
|
||||
let num_port = Cell(num_port);
|
||||
let new_future = do future::spawn {
|
||||
let num_chan = num_chan2.take();
|
||||
let num_port1 = num_port.take();
|
||||
thread_ring(i, msg_per_task, num_chan, num_port1)
|
||||
let num_chan2 = ~mut None;
|
||||
*num_chan2 <-> num_chan;
|
||||
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(num_chan),
|
||||
option::unwrap(num_port1))
|
||||
};
|
||||
futures.push(new_future);
|
||||
num_chan = Some(new_chan);
|
||||
|
|
|
|||
|
|
@ -17,15 +17,13 @@
|
|||
//
|
||||
// The filename is a song reference; google it in quotes.
|
||||
|
||||
use core::cell::Cell;
|
||||
|
||||
fn child_generation(gens_left: uint, -c: comm::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 = Cell(c);
|
||||
do task::spawn_supervised {
|
||||
let c = c.take();
|
||||
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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue