diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-03-02 20:55:40 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-03-05 19:39:55 -0800 |
| commit | d7298a797b1041e9e997378bdb3cd4923567b2d4 (patch) | |
| tree | 8b7053f6f17fffd4df016920e3f591df4189f9e6 /src/rt/rust_task.cpp | |
| parent | 8a4c8bab8486592b2606afb275ad62974ed89767 (diff) | |
| download | rust-d7298a797b1041e9e997378bdb3cd4923567b2d4.tar.gz rust-d7298a797b1041e9e997378bdb3cd4923567b2d4.zip | |
rt: Protect rust_task::killed with a lock
Diffstat (limited to 'src/rt/rust_task.cpp')
| -rw-r--r-- | src/rt/rust_task.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp index 952e5c8c47d..92637ace632 100644 --- a/src/rt/rust_task.cpp +++ b/src/rt/rust_task.cpp @@ -155,9 +155,12 @@ cleanup_task(cleanup_args *args) { task->die(); - if (task->killed && !threw_exception) { - LOG(task, task, "Task killed during termination"); - threw_exception = true; + { + scoped_lock with(task->kill_lock); + if (task->killed && !threw_exception) { + LOG(task, task, "Task killed during termination"); + threw_exception = true; + } } task->notify(!threw_exception); @@ -244,6 +247,7 @@ void rust_task::start() bool rust_task::must_fail_from_being_killed() { + scoped_lock with(kill_lock); return killed && !reentered_rust_stack; } @@ -275,7 +279,10 @@ rust_task::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; + { + scoped_lock with(kill_lock); + killed = true; + } // Unblock the task so it can unwind. unblock(); |
