Skip to content

Commit 2d9ce7e

Browse files
committed
---
yaml --- r: 11636 b: refs/heads/master c: d7298a7 h: refs/heads/master v: v3
1 parent 72a7268 commit 2d9ce7e

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 8a4c8bab8486592b2606afb275ad62974ed89767
2+
refs/heads/master: d7298a797b1041e9e997378bdb3cd4923567b2d4
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rt/rust_task.cpp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@ cleanup_task(cleanup_args *args) {
155155

156156
task->die();
157157

158-
if (task->killed && !threw_exception) {
159-
LOG(task, task, "Task killed during termination");
160-
threw_exception = true;
158+
{
159+
scoped_lock with(task->kill_lock);
160+
if (task->killed && !threw_exception) {
161+
LOG(task, task, "Task killed during termination");
162+
threw_exception = true;
163+
}
161164
}
162165

163166
task->notify(!threw_exception);
@@ -244,6 +247,7 @@ void rust_task::start()
244247

245248
bool
246249
rust_task::must_fail_from_being_killed() {
250+
scoped_lock with(kill_lock);
247251
return killed && !reentered_rust_stack;
248252
}
249253

@@ -275,7 +279,10 @@ rust_task::kill() {
275279
// If you want to fail yourself you do self->fail().
276280
LOG(this, task, "killing task %s @0x%" PRIxPTR, name, this);
277281
// When the task next goes to yield or resume it will fail
278-
killed = true;
282+
{
283+
scoped_lock with(kill_lock);
284+
killed = true;
285+
}
279286
// Unblock the task so it can unwind.
280287
unblock();
281288

trunk/src/rt/rust_task.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ rust_task : public kernel_owned<rust_task>, rust_cond
107107

108108
private:
109109

110+
// Protects the killed flag
111+
lock_and_signal kill_lock;
110112
// Indicates that the task was killed and needs to unwind
111113
bool killed;
112114
// Indicates that we've called back into Rust from C

0 commit comments

Comments
 (0)