sched: Do not re-fire expired callbacks, use sh4_sched_remaing on sh4_sched_tick

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis 2015-05-07 21:33:36 +02:00
parent 0614680f8c
commit 20f7a41fe9
1 changed files with 11 additions and 5 deletions

View File

@ -36,11 +36,11 @@ vector<sched_list> list;
int sh4_sched_next_id=-1;
u32 sh4_sched_remaining(int id)
u32 sh4_sched_remaining(int id, u32 reference)
{
if (list[id].end!=-1)
if (list[id].end != -1)
{
return list[id].end-sh4_sched_now();
return list[id].end - reference;
}
else
{
@ -48,6 +48,11 @@ u32 sh4_sched_remaining(int id)
}
}
u32 sh4_sched_remaining(int id)
{
return sh4_sched_remaining(id, sh4_sched_now());
}
void sh4_sched_ffts()
{
u32 diff=-1;
@ -150,8 +155,9 @@ void sh4_sched_tick(int cycles)
{
for (int i=0;i<list.size();i++)
{
if ((list[i].end-fztime)<=(u32)cycles)
{
int remaining = sh4_sched_remaining(i, fztime);
verify(remaining >= 0 || remaining == -1);
if (remaining >= 0 && remaining <= (u32)cycles) {
handle_cb(i);
}
}