中级会员
 
- 积分
- 378
- 金钱
- 378
- 注册时间
- 2017-11-29
- 在线时间
- 135 小时
|
发表于 2018-3-30 15:18:50
|
显示全部楼层
在创建新任务的代码中xTaskCreate---prvAddNewTaskToReadyList函数中有这样一段代码:
if( xSchedulerRunning != pdFALSE )
{
/* If the created task is of a higher priority than the current task
then it should run now. */
if( pxCurrentTCB->uxPriority < pxNewTCB->uxPriority )
{
taskYIELD_IF_USING_PREEMPTION(); //为何不在这里更新pxCurrentTCB = pxNewTCB?
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
如果新创建的任务优先级比当前的任务优先级高并且此时调度器是运行的,那么是会任务调度的。求跟帖讨论 |
|