base-hw: Ada-compliant scheduler method signatures

Ref #3308
This commit is contained in:
Martin Stein 2020-01-06 11:26:05 +01:00 committed by Christian Helmuth
parent 0d5f185267
commit e42a205a51
4 changed files with 14 additions and 9 deletions

View File

@ -116,7 +116,12 @@ Cpu::Idle_thread::Idle_thread(Cpu &cpu)
void Cpu::schedule(Job * const job) void Cpu::schedule(Job * const job)
{ {
if (_id == executing_id()) { _scheduler.ready(job->share()); } if (_id == executing_id()) { _scheduler.ready(job->share()); }
else if (_scheduler.ready_check(job->share())) { trigger_ip_interrupt(); } else {
_scheduler.ready_check(job->share());
if (_scheduler.need_to_schedule()) {
trigger_ip_interrupt();
}
}
} }

View File

@ -153,14 +153,15 @@ void Cpu_scheduler::update(time_t time)
} }
bool Cpu_scheduler::ready_check(Share &s1) void Cpu_scheduler::ready_check(Share &s1)
{ {
assert(_head); assert(_head);
ready(s1); ready(s1);
if (_need_to_schedule) return _need_to_schedule; if (_need_to_schedule) {
return;
}
Share * s2 = _head; Share * s2 = _head;
if (!s1._claim) { if (!s1._claim) {
_need_to_schedule = s2 == &_idle; _need_to_schedule = s2 == &_idle;
@ -178,7 +179,6 @@ bool Cpu_scheduler::ready_check(Share &s1)
_need_to_schedule = !s2; _need_to_schedule = !s2;
} }
return _need_to_schedule;
} }

View File

@ -177,7 +177,7 @@ class Kernel::Cpu_scheduler
/** /**
* Set 's1' ready and return wether this outdates current head * Set 's1' ready and return wether this outdates current head
*/ */
bool ready_check(Share &s1); void ready_check(Share &s1);
/** /**
* Set share 's' ready * Set share 's' ready

View File

@ -119,9 +119,9 @@ void update_check(unsigned const l, unsigned const c, unsigned const t,
void ready_check(unsigned const l, unsigned const s, bool const x) void ready_check(unsigned const l, unsigned const s, bool const x)
{ {
bool const y = data()->scheduler.ready_check(*share(s)); data()->scheduler.ready_check(*share(s));
if (y != x) { if (data()->scheduler.need_to_schedule() != x) {
Genode::log("wrong check result ", y, " in line ", l); Genode::log("wrong check result ", data()->scheduler.need_to_schedule(), " in line ", l);
done(); done();
} }
} }