diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-12 19:52:32 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-13 20:13:53 -0400 |
| commit | d338879ba5fef07890930abce6c8dd3549fe6fd4 (patch) | |
| tree | a09a21d14eeaca77a0ef9f8701f9860679f5b554 /src/rt/rust_task.cpp | |
| parent | 62575d9c4a26eb2fa0bd1a1dbf1580633a886dce (diff) | |
| download | rust-d338879ba5fef07890930abce6c8dd3549fe6fd4.tar.gz rust-d338879ba5fef07890930abce6c8dd3549fe6fd4.zip | |
Reintroduce linked failure (killing runtime)
This reverts commit 5724c6454950617c292daba89cdb9a3b4c862430.
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 3d88c05b3ff..a6c9b791fda 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -129,6 +129,11 @@ cleanup_task(cleanup_args *args) { // assert(task->task_local_data != NULL); task->task_local_data_cleanup(task->task_local_data); task->task_local_data = NULL; + } else if (threw_exception) { + // Edge case: If main never spawns any tasks, but fails anyway, TLS + // won't be around to take down the kernel (task.rs:kill_taskgroup, + // rust_task_kill_all). Do it here instead. + task->fail_sched_loop(); } // FIXME (#2676): For performance we should do the annihilator @@ -282,6 +287,7 @@ rust_task::kill() { LOG(this, task, "preparing to unwind task: 0x%" PRIxPTR, this); } +// TODO(bblum): Move this to rust_builtin.cpp (cleanup) extern "C" CDECL bool rust_task_is_unwinding(rust_task *rt) { return rt->unwinding; @@ -315,10 +321,14 @@ rust_task::begin_failure(char const *expr, char const *file, size_t line) { #else die(); // FIXME (#908): Need unwinding on windows. This will end up aborting - sched_loop->fail(); + fail_sched_loop(); #endif } +void rust_task::fail_sched_loop() { + sched_loop->fail(); +} + void rust_task::unsupervise() { |
