if(c) {
break;
}
for(i=0;i<=MAX_TASK_NUMBER;i++) {
p = &g_task_tbl[i];
if( p->task_id == i && p->task_func_p ) {
if( p->sleep_time == 0 )
p->counter = 10;
continue;
}
p->counter = 0;
}
}
return next;
}
kernel_start()中增加对sched_init()的调用。
软中断时调用schedule1()做任务调度
void do_syscall_timer(void)
{
unsigned int task_id;
if( current->counter > 0 ) {
current->counter--;
if( current->sleep_time == 0 ) {
return;
}
}
task_id = schedule1();
current = &g_task_tbl[task_id];
return;
}