blob: cb3cb5e95fbc90c21e496c226ef64f53b00ffcc7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#include <kernel/task.H>
#include <kernel/scheduler.H>
#include <kernel/taskmgr.H>
#include <kernel/cpu.H>
#include <kernel/cpumgr.H>
#include <kernel/console.H>
#include <kernel/timemgr.H>
void Scheduler::addTask(task_t* t)
{
if (t->cpu->idle_task != t)
{
iv_taskList.insert(t);
}
}
void Scheduler::returnRunnable()
{
this->addTask(TaskManager::getCurrentTask());
}
void Scheduler::setNextRunnable()
{
task_t* t = iv_taskList.remove();
if (NULL == t)
{
t = CpuManager::getCurrentCPU()->idle_task;
// TODO: Set short decrementer.
setDEC(TimeManager::getTimeSliceCount());
}
else // Set normal timeslice to decrementer.
{
setDEC(TimeManager::getTimeSliceCount());
}
TaskManager::setCurrentTask(t);
}
|