6 class Timeslice_timeout : public Timeout
14 #include "sched_context.h"
15 #include "std_macros.h"
17 /* Initialize global valiable timeslice_timeout */
18 DEFINE_PER_CPU Per_cpu<Timeout *> timeslice_timeout;
19 DEFINE_PER_CPU static Per_cpu<Timeslice_timeout> the_timeslice_timeout(true);
22 Timeslice_timeout::Timeslice_timeout(Cpu_number cpu)
24 timeslice_timeout.cpu(cpu) = this;
29 * Timeout expiration callback function
30 * @return true to force a reschedule
34 Timeslice_timeout::expired()
36 Sched_context::Ready_queue &rq = Sched_context::rq.current();
37 Sched_context *sched = rq.current_sched();
42 Context *owner = sched->owner();
44 // Ensure sched is owner's current timeslice
45 assert (owner->sched() == sched);
49 rq.invalidate_sched();
51 // owner->switch_sched(sched);
54 return true; // Force reschedule