diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-09-14 14:20:13 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-09-14 14:20:41 -0700 |
| commit | 9505d70513ebd38d1a404b1dde3c181f40f86b75 (patch) | |
| tree | ff16cb5e435cf456a5da1fbee44e4e6d02dddd7b /src/rt/rust_task.cpp | |
| parent | c61f06fde9757e6f1208399be7473f5a50d6e10b (diff) | |
| download | rust-9505d70513ebd38d1a404b1dde3c181f40f86b75.tar.gz rust-9505d70513ebd38d1a404b1dde3c181f40f86b75.zip | |
Make linked task failure work again
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index b861c60b521..e99ccc1d04b 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -74,6 +74,7 @@ rust_task::rust_task(rust_scheduler *sched, rust_task_list *state, local_region(&sched->srv->local_region), _on_wakeup(NULL), failed(false), + killed(false), propagate_failure(true), dynastack(this) { @@ -253,10 +254,19 @@ rust_task::yield(size_t time_in_us) { LOG(this, task, "task %s @0x%" PRIxPTR " yielding for %d us", name, this, time_in_us); + if (killed) { + killed = false; + fail(); + } yield_timer.reset_us(time_in_us); // Return to the scheduler. ctx.next->swap(ctx); + + if (killed) { + killed = false; + fail(); + } } void @@ -270,12 +280,11 @@ rust_task::kill() { // from task A and want to force-fail task B, you do B->kill(). // If you want to fail yourself you do self->fail(). LOG(this, task, "killing task %s @0x%" PRIxPTR, name, this); + // When the task next goes to yield or resume it will fail + killed = true; // Unblock the task so it can unwind. unblock(); - if (NULL == supervisor && propagate_failure) - sched->fail(); - sched->lock.signal(); LOG(this, task, "preparing to unwind task: 0x%" PRIxPTR, this); |
