Skip to content

Commit

Permalink
[2/4 for #2365, #2671] Fix exit/kill race with tasks during rust_kern…
Browse files Browse the repository at this point in the history
…el::fail
  • Loading branch information
bblum committed Jul 20, 2012
1 parent 5bb4a12 commit 18c645a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rt/rust_sched_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,23 @@ rust_sched_loop::kill_all_tasks() {
killed = true;

for (size_t i = 0; i < running_tasks.length(); i++) {
all_tasks.push_back(running_tasks[i]);
rust_task *t = running_tasks[i];
t->ref();
all_tasks.push_back(t);
}

for (size_t i = 0; i < blocked_tasks.length(); i++) {
all_tasks.push_back(blocked_tasks[i]);
rust_task *t = blocked_tasks[i];
t->ref();
all_tasks.push_back(t);
}
}

while (!all_tasks.empty()) {
rust_task *task = all_tasks.back();
all_tasks.pop_back();
task->kill();
task->deref();
}
}

Expand Down

0 comments on commit 18c645a

Please sign in to comment.