Merge pull request #4323 from cpeterso/cpeterso-schedule-task

rt: Remove dead code from schedule_task()
This commit is contained in:
Brian Anderson 2012-12-31 21:51:45 -08:00
commit 84a37a3859

View File

@ -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();
}
@ -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;
}