Skip to content

Code Review 1: 关于cooperative multitasking的讨论 #2

@LeeReindeer

Description

@LeeReindeer

ROS/ros.c

Line 139 in 048799c

new_tcb = ros_tcb_dequeue(current_tcb->priority);

else {
    // remove terminated task
    do {
      new_tcb = ros_tcb_dequeue(current_tcb->priority);
    } while (new_tcb && new_tcb->status == TASK_TERMINATED);
    if (new_tcb) {
      ros_tcb_enqueue(current_tcb);
      ros_switch_context_shell(current_tcb, new_tcb);
    }
  1. 是否存在一个低优先级任务被调度器切出,而被高优先级任务抢占的情况?
  2. 调度器会进入该 else 分支吗(存在需要删除TASK_TERMINATED的任务的情况吗?)?如不存在可以删除该分支

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions