diff options
| author | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-10 21:45:53 -0400 |
|---|---|---|
| committer | Ben Blum <bblum@andrew.cmu.edu> | 2012-07-11 12:07:06 -0400 |
| commit | 5d6d3d056592cf4d68afbce6084245ea6733865c (patch) | |
| tree | 88497948489aa8de2e71f4d76e852f5206803243 /src/rt/rust_task.cpp | |
| parent | 152f2eade87b7930a83f9cc8da8cae08769b2faf (diff) | |
| download | rust-5d6d3d056592cf4d68afbce6084245ea6733865c.tar.gz rust-5d6d3d056592cf4d68afbce6084245ea6733865c.zip | |
Linked failure in task.rs instead of rust_task.cpp (#1868, #1189)
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index f5e2fcc9a08..d23d74b0ea2 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -10,6 +10,8 @@ #include "rust_env.h" #include "rust_port.h" +// TODO(bblum): get rid of supervisors + // Tasks rust_task::rust_task(rust_sched_loop *sched_loop, rust_task_state state, rust_task *spawner, const char *name, @@ -146,13 +148,9 @@ cleanup_task(cleanup_args *args) { task->notify(!threw_exception); - if (threw_exception) { -#ifndef __WIN32__ - task->conclude_failure(); -#else - assert(false && "Shouldn't happen"); +#ifdef __WIN32__ + assert(!threw_exception && "No exception-handling yet on windows builds"); #endif - } } extern "C" CDECL void upcall_exchange_free(void *ptr); @@ -262,10 +260,7 @@ void rust_task::kill() { scoped_lock with(kill_lock); - if (dead()) { - // Task is already dead, can't kill what's already dead. - fail_parent(); - } + // XXX: bblum: kill/kill race // Note the distinction here: kill() is when you're in an upcall // from task A and want to force-fail task B, you do B->kill(). @@ -314,32 +309,12 @@ rust_task::begin_failure(char const *expr, char const *file, size_t line) { throw this; #else die(); - conclude_failure(); // FIXME (#908): Need unwinding on windows. This will end up aborting sched_loop->fail(); #endif } void -rust_task::conclude_failure() { - fail_parent(); -} - -void -rust_task::fail_parent() { - scoped_lock with(supervisor_lock); - if (supervisor) { - DLOG(sched_loop, task, - "task %s @0x%" PRIxPTR - " propagating failure to supervisor %s @0x%" PRIxPTR, - name, this, supervisor->name, supervisor); - supervisor->kill(); - } - if (NULL == supervisor && propagate_failure) - sched_loop->fail(); -} - -void rust_task::unsupervise() { scoped_lock with(supervisor_lock); |
