Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/rt/rust_sched_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ rust_sched_loop::kill_all_tasks() {

size_t
rust_sched_loop::number_of_live_tasks() {
lock.must_have_lock();
return running_tasks.length() + blocked_tasks.length();
}

Expand Down Expand Up @@ -148,14 +149,10 @@ rust_sched_loop::release_task(rust_task *task) {
rust_task *
rust_sched_loop::schedule_task() {
lock.must_have_lock();
assert(this);
if (running_tasks.length() > 0) {
size_t k = isaac_rand(&rctx);
// Look around for a runnable task, starting at k.
for(size_t j = 0; j < running_tasks.length(); ++j) {
size_t i = (j + k) % running_tasks.length();
return (rust_task *)running_tasks[i];
}
size_t i = k % running_tasks.length();
return (rust_task *)running_tasks[i];
}
return NULL;
}
Expand Down