mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 04:39:16 +00:00
Fix run-fail/spawnfail
Catch the case where a parent is killed immediately before it terminates normally.
This commit is contained in:
parent
fcdb313bd5
commit
07771ec25b
@ -191,6 +191,13 @@ void task_start_wrapper(spawn_args *a)
|
|||||||
task->free(env);
|
task->free(env);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task->die();
|
||||||
|
|
||||||
|
if (task->killed && !failed) {
|
||||||
|
LOG(task, task, "Task killed during termination");
|
||||||
|
failed = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
task->conclude_failure();
|
task->conclude_failure();
|
||||||
@ -198,7 +205,6 @@ void task_start_wrapper(spawn_args *a)
|
|||||||
A(task->sched, false, "Shouldn't happen");
|
A(task->sched, false, "Shouldn't happen");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
task->die();
|
|
||||||
task->lock.lock();
|
task->lock.lock();
|
||||||
task->notify_tasks_waiting_to_join();
|
task->notify_tasks_waiting_to_join();
|
||||||
task->lock.unlock();
|
task->lock.unlock();
|
||||||
@ -316,13 +322,13 @@ rust_task::fail() {
|
|||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
throw this;
|
throw this;
|
||||||
#else
|
#else
|
||||||
|
die();
|
||||||
conclude_failure();
|
conclude_failure();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rust_task::conclude_failure() {
|
rust_task::conclude_failure() {
|
||||||
die();
|
|
||||||
// Unblock the task so it can unwind.
|
// Unblock the task so it can unwind.
|
||||||
unblock();
|
unblock();
|
||||||
fail_parent();
|
fail_parent();
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
// xfail-test
|
// xfail-win32
|
||||||
// error-pattern:explicit
|
// error-pattern:explicit
|
||||||
use std;
|
use std;
|
||||||
import std::task;
|
import std::task;
|
||||||
|
|
||||||
// We don't want to see any invalid reads
|
// We don't want to see any invalid reads
|
||||||
fn main() {
|
fn main() {
|
||||||
fn f() {
|
fn f(&&_i: ()) {
|
||||||
fail;
|
fail;
|
||||||
}
|
}
|
||||||
let g = f;
|
task::spawn((), f);
|
||||||
task::spawn(g);
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user