金牌会员
- 积分
- 2305
- 金钱
- 2305
- 注册时间
- 2017-7-6
- 在线时间
- 280 小时
|
3金钱
void OS_RdyListInsert (OS_TCB *p_tcb),里面为啥要根据任务的优先级是否是当前优先级,如果是当前优先级就尾插到就绪任务列表,如果不是就头插。我想问WHY?另外吐槽我粘贴代码过来是C格式不是不行?
void OS_RdyListInsert (OS_TCB *p_tcb)
{
OS_PrioInsert(p_tcb->Prio);
if (p_tcb->Prio == OSPrioCur) { /* Are we readying a task at the same prio? */
OS_RdyListInsertTail(p_tcb); /* Yes, insert readied task at the end of the list */
} else {
OS_RdyListInsertHead(p_tcb); /* No, insert readied task at the beginning of the list */
}
#if (defined(TRACE_CFG_EN) && (TRACE_CFG_EN > 0u))
TRACE_OS_TASK_READY(p_tcb); /* Record the event. */
#endif
}
|
|