auto merge of #10603 : alexcrichton/rust/no-linked-failure, r=brson

The reasons for doing this are:

* The model on which linked failure is based is inherently complex
* The implementation is also very complex, and there are few remaining who
  fully understand the implementation
* There are existing race conditions in the core context switching function of
  the scheduler, and possibly others.
* It's unclear whether this model of linked failure maps well to a 1:1 threading
  model

Linked failure is often a desired aspect of tasks, but we would like to take a
much more conservative approach in re-implementing linked failure if at all.

Closes #8674
Closes #8318
Closes #8863
This commit is contained in:
bors 2013-11-24 21:32:13 -08:00
commit 2cc1e16ac0
39 changed files with 400 additions and 2528 deletions

View file

@ -179,9 +179,9 @@ fn main() {
let (from_parent, to_child) = comm::stream();
do task::spawn_with(from_parent) |from_parent| {
do spawn {
make_sequence_processor(sz, &from_parent, &to_parent_);
};
}
to_child
}.collect::<~[Chan<~[u8]>]>();

View file

@ -28,7 +28,7 @@ fn child_generation(gens_left: uint, c: comm::Chan<()>) {
// With this code, only as many generations are alive at a time as tasks
// alive at a time,
let c = Cell::new(c);
do task::spawn_supervised {
do spawn {
let c = c.take();
if gens_left & 1 == 1 {
task::deschedule(); // shake things up a bit

View file

@ -1,4 +1,5 @@
// xfail-pretty
// xfail-test linked failure
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
@ -35,8 +36,6 @@ fn grandchild_group(num_tasks: uint) {
for _ in range(0, num_tasks) {
let ch = ch.clone();
let mut t = task::task();
t.linked();
t.unwatched();
do t.spawn { // linked
ch.send(());
let (p, _c) = stream::<()>();

View file

@ -10,8 +10,11 @@
// error-pattern:task '<unnamed>' failed at 'test'
use std::task;
fn main() {
do spawn {
do task::try {
fail!("test");
}
1
}.unwrap()
}

View file

@ -10,10 +10,13 @@
// error-pattern:task 'owned name' failed at 'test'
use std::task;
fn main() {
let mut t = ::std::task::task();
let mut t = task::task();
t.name(~"owned name");
do t.spawn {
do t.try {
fail!("test");
}
1
}.unwrap()
}

View file

@ -13,7 +13,8 @@
fn main() {
let mut t = ::std::task::task();
t.name("send name".to_send_str());
do t.spawn {
do t.try {
fail!("test");
}
3
}.unwrap()
}

View file

@ -13,7 +13,7 @@
fn main() {
let mut t = ::std::task::task();
t.name("static name");
do t.spawn {
do t.try {
fail!("test");
}
}.unwrap()
}

View file

@ -15,7 +15,7 @@ use std::task;
fn main() {
// the purpose of this test is to make sure that task::spawn()
// works when provided with a bare function:
task::spawn(startfn);
task::try(startfn).unwrap();
}
fn startfn() {

View file

@ -18,5 +18,5 @@ fn f() {
}
pub fn main() {
task::spawn_unlinked(f);
task::spawn(f);
}

View file

@ -42,7 +42,7 @@ fn f(c: SharedChan<bool>) {
pub fn main() {
let (p, c) = stream();
let c = SharedChan::new(c);
task::spawn_unlinked(|| f(c.clone()) );
task::spawn(|| f(c.clone()) );
error!("hiiiiiiiii");
assert!(p.recv());
}

View file

@ -35,5 +35,5 @@ fn f() {
}
pub fn main() {
task::spawn_unlinked(f);
task::spawn(f);
}

View file

@ -18,5 +18,5 @@ fn f() {
}
pub fn main() {
task::spawn_unlinked(f);
task::spawn(f);
}